Skip to content

Commit

Permalink
General language server fixes (#282)
Browse files Browse the repository at this point in the history
* general language server fixes

* try again

* remove import

* try this
  • Loading branch information
mattwparas authored Nov 3, 2024
1 parent 41a3b6f commit bbb872a
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 166 deletions.
44 changes: 1 addition & 43 deletions crates/steel-core/src/steel_vm/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ use std::{
use crate::values::HashMap as ImmutableHashMap;
use fxhash::{FxBuildHasher, FxHashMap};
use lasso::ThreadedRodeo;
use once_cell::sync::OnceCell;
use once_cell::sync::{Lazy, OnceCell};
use parking_lot::{
MappedRwLockReadGuard, MappedRwLockWriteGuard, RwLock, RwLockReadGuard, RwLockWriteGuard,
};
Expand Down Expand Up @@ -505,54 +505,12 @@ impl Engine {
register_builtin_modules(&mut vm, sandbox)
);

// These are used for creating the bootstrapped image
// let USE_BOOTSTRAP = false;
// let EMIT_BOOTSTRAP = false;

// if EMIT_BOOTSTRAP {
// let bootstrap = vm
// .emit_raw_program(
// crate::steel_vm::primitives::ALL_MODULES,
// PathBuf::from("dumb.scm"),
// )
// .unwrap()
// .into_serializable_program()
// .map(|program| NonInteractiveProgramImage {
// sources: vm.sources.clone(),
// program,
// })
// .unwrap();

// let mut output = PathBuf::from("crates/steel-core/src/boot/all-modules-builtins.boot");

// bootstrap.write_bytes_to_file(&output);
// };

// if USE_BOOTSTRAP {
// time!(
// "engine-creation",
// "Loading the ALL_MODULES prelude code from bootstrap",
// {
// let program = NonInteractiveProgramImage::from_bytes(include_bytes!(
// "../boot/all-modules-builtins.boot"
// ));

// vm.sources = program.sources;

// let raw_program =
// SerializableRawProgramWithSymbols::into_raw_program(program.program);
// vm.run_raw_program(raw_program).unwrap();
// }
// )
// } else {

time!(
"engine-creation",
"Loading the ALL_MODULES prelude code",
vm.compile_and_run_raw_program(crate::steel_vm::primitives::ALL_MODULES)
.expect("loading ALL_MODULES failed")
);
// }

// log::debug!(target: "kernel", "Registered modules in the kernel!: {:?}", now.elapsed());

Expand Down
11 changes: 5 additions & 6 deletions crates/steel-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ pub fn function(
}
}

let arity_number = type_vec.len();
let mut arity_number = type_vec.len();

// TODO: Awful hack, but this just keeps track of which
// variables are presented as mutable, which we can then use to chn
Expand Down Expand Up @@ -571,6 +571,7 @@ pub fn function(
);

let arity_exactness = if rest_arg_generic_inner_type {
arity_number -= 1;
quote! { AtLeast }
} else {
quote! { Exact }
Expand Down Expand Up @@ -629,8 +630,6 @@ pub fn function(
*last = quote! { #last.. };
}

let arity_number = arity_number - 1;

if let Some(last) = conversion_functions.last_mut() {
*last = quote! { from_slice };
}
Expand Down Expand Up @@ -907,7 +906,7 @@ pub fn custom_function(
}
}

let arity_number = type_vec.len();
let mut arity_number = type_vec.len();

// TODO: Awful hack, but this just keeps track of which
// variables are presented as mutable, which we can then use to chn
Expand Down Expand Up @@ -953,6 +952,8 @@ pub fn custom_function(
);

let arity_exactness = if rest_arg_generic_inner_type {
// We don't want to include the rest argument in the count
arity_number -= 1;
quote! { AtLeast }
} else {
quote! { Exact }
Expand Down Expand Up @@ -1011,8 +1012,6 @@ pub fn custom_function(
*last = quote! { #last.. };
}

let arity_number = arity_number - 1;

if let Some(last) = conversion_functions.last_mut() {
*last = quote! { from_slice };
}
Expand Down
2 changes: 1 addition & 1 deletion crates/steel-language-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ tower-lsp = { version = "0.20.0", features = ["proposed"] }
serde = { version = "1.0.152", features = ["derive"] }
dashmap = "5.1.0"
log = "0.4.17"
steel-core = { workspace = true }
steel-core = { path = "../steel-core", version = "0.6.0", features = ["dylibs", "markdown", "stacker", "sync"] }
once_cell = "1.18.0"
Loading

0 comments on commit bbb872a

Please sign in to comment.