Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

51 fix oom #55

Merged
merged 3 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
**/*.out
**/*.vcd
**/*.fst
sus-lsp/
11 changes: 11 additions & 0 deletions src/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ impl<IndexMarker> UUIDRange<IndexMarker> {
pub fn new(from: UUID<IndexMarker>, to: UUID<IndexMarker>) -> Self {
Self(from, to)
}
pub fn new_with_length(len: usize) -> Self {
UUIDRange(UUID(0, PhantomData), UUID(len, PhantomData))
}
pub fn empty() -> Self {
UUIDRange(UUID(0, PhantomData), UUID(0, PhantomData))
}
Expand Down Expand Up @@ -495,6 +498,14 @@ impl<T, IndexMarker> FlatAlloc<T, IndexMarker> {
_ph: PhantomData,
}
}
pub fn with_size(size: usize, v: T) -> Self where T: Clone {
let mut data = Vec::new();
data.resize(size, v);
Self {
data,
_ph: PhantomData
}
}
pub fn get_next_alloc_id(&self) -> UUID<IndexMarker> {
let uuid = self.data.len();
UUID(uuid, PhantomData)
Expand Down
5 changes: 3 additions & 2 deletions src/dev_aid/lsp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ impl Linker {
found
} else {
let file_text = std::fs::read_to_string(uri.to_file_path().unwrap()).unwrap();

let file_uuid = self.add_file(uri.to_string(), file_text, manager);
self.recompile_all();
file_uuid
Expand Down Expand Up @@ -414,9 +415,9 @@ fn handle_request(
)))
}
request::SemanticTokensFullRequest::METHOD => {
println!("SemanticTokensFullRequest: {params}");
let params: SemanticTokensParams =
serde_json::from_value(params).expect("JSON Encoding Error while parsing params");
println!("SemanticTokensFullRequest");

let uuid = linker.ensure_contains_file(&params.text_document.uri, manager);

Expand Down Expand Up @@ -539,7 +540,7 @@ fn handle_notification(
push_all_errors(&connection, &linker)?;
}
other => {
println!("got notification: {other:?}");
println!("got other notification: {other:?}");
}
}
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion src/typing/abstract_type.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::alloc::ArenaAllocator;
use crate::alloc::{ArenaAllocator, UUID};
use crate::prelude::*;
use crate::value::Value;
use std::ops::Deref;
Expand Down
Loading
Loading