line up stuff

pull/8675/merge^2
mattwparas 2 years ago
parent ddca44e02b
commit 798c6a5180

1
Cargo.lock generated

@ -1557,6 +1557,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"slotmap", "slotmap",
"steel-core",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
"toml", "toml",

@ -91,12 +91,27 @@ impl Custom for PromptEvent {}
impl<'a> CustomReference for Context<'a> {} impl<'a> CustomReference for Context<'a> {}
fn get_editor<'a>(cx: &'a mut Context<'a>) -> &'a mut Editor {
cx.editor
}
fn configure_engine() -> std::rc::Rc<std::cell::RefCell<steel::steel_vm::engine::Engine>> { fn configure_engine() -> std::rc::Rc<std::cell::RefCell<steel::steel_vm::engine::Engine>> {
let mut engine = steel::steel_vm::engine::Engine::new(); let mut engine = steel::steel_vm::engine::Engine::new();
let mut module = BuiltInModule::new("helix/core/keybindings".to_string()); let mut module = BuiltInModule::new("helix/core/keybindings".to_string());
module.register_fn("set-keybindings!", SharedKeyBindingsEventQueue::merge); module.register_fn("set-keybindings!", SharedKeyBindingsEventQueue::merge);
RegisterFn::<
_,
steel::steel_vm::register_fn::MarkerWrapper7<(
Context<'_>,
helix_view::Editor,
helix_view::Editor,
Context<'static>,
)>,
helix_view::Editor,
>::register_fn(&mut engine, "cx-editor!", get_editor);
engine.register_module(module); engine.register_module(module);
let mut module = BuiltInModule::new("helix/core/typable".to_string()); let mut module = BuiltInModule::new("helix/core/typable".to_string());
@ -163,6 +178,10 @@ fn configure_engine() -> std::rc::Rc<std::cell::RefCell<steel::steel_vm::engine:
let helix_path = let helix_path =
"__module-mangler".to_string() + helix_module_path.as_os_str().to_str().unwrap(); "__module-mangler".to_string() + helix_module_path.as_os_str().to_str().unwrap();
// mangler/home/matt/Documents/steel/cogs/logging/log.scmlog/warn!__doc__
let module_prefix = "mangler".to_string() + helix_module_path.as_os_str().to_str().unwrap();
let module = engine.extract_value(&helix_path).unwrap(); let module = engine.extract_value(&helix_path).unwrap();
if let steel::rvals::SteelVal::HashMapV(m) = module { if let steel::rvals::SteelVal::HashMapV(m) = module {
@ -178,26 +197,20 @@ fn configure_engine() -> std::rc::Rc<std::cell::RefCell<steel::steel_vm::engine:
}) })
.collect::<HashSet<_>>(); .collect::<HashSet<_>>();
*EXPORTED_IDENTIFIERS.identifiers.write().unwrap() = exported; let docs = exported
let docs = m
.iter() .iter()
.filter_map(|(k, v)| { .filter_map(|x| {
if let steel::rvals::SteelVal::SymbolV(s) = k { if let Ok(steel::rvals::SteelVal::StringV(d)) =
if s.ends_with("__doc__") { engine.extract_value(&(module_prefix.to_string() + x.as_str() + "__doc__"))
if let steel::rvals::SteelVal::StringV(d) = v { {
return Some(( Some((x.to_string(), d.to_string()))
s.strip_suffix("__doc__").unwrap().to_string(), } else {
d.to_string(),
));
}
}
}
None None
}
}) })
.collect::<HashMap<_, _>>(); .collect::<HashMap<_, _>>();
*EXPORTED_IDENTIFIERS.identifiers.write().unwrap() = exported;
*EXPORTED_IDENTIFIERS.docs.write().unwrap() = docs; *EXPORTED_IDENTIFIERS.docs.write().unwrap() = docs;
} else { } else {
panic!("Unable to parse exported identifiers from helix module!") panic!("Unable to parse exported identifiers from helix module!")

@ -45,6 +45,9 @@ log = "~0.4"
which = "4.4" which = "4.4"
parking_lot = "0.12.1" parking_lot = "0.12.1"
# plugin support
steel-core = { path = "../../../steel/crates/steel-core", version = "0.2.0", features = ["modules", "anyhow"] }
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
clipboard-win = { version = "4.5", features = ["std"] } clipboard-win = { version = "4.5", features = ["std"] }

@ -799,6 +799,8 @@ pub struct Breakpoint {
use futures_util::stream::{Flatten, Once}; use futures_util::stream::{Flatten, Once};
impl steel::gc::unsafe_erased_pointers::CustomReference for Editor {}
pub struct Editor { pub struct Editor {
/// Current editing mode. /// Current editing mode.
pub mode: Mode, pub mode: Mode,

Loading…
Cancel
Save