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_json",
"slotmap",
"steel-core",
"tokio",
"tokio-stream",
"toml",

@ -91,12 +91,27 @@ impl Custom for PromptEvent {}
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>> {
let mut engine = steel::steel_vm::engine::Engine::new();
let mut module = BuiltInModule::new("helix/core/keybindings".to_string());
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);
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 =
"__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();
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<_>>();
*EXPORTED_IDENTIFIERS.identifiers.write().unwrap() = exported;
let docs = m
let docs = exported
.iter()
.filter_map(|(k, v)| {
if let steel::rvals::SteelVal::SymbolV(s) = k {
if s.ends_with("__doc__") {
if let steel::rvals::SteelVal::StringV(d) = v {
return Some((
s.strip_suffix("__doc__").unwrap().to_string(),
d.to_string(),
));
}
}
.filter_map(|x| {
if let Ok(steel::rvals::SteelVal::StringV(d)) =
engine.extract_value(&(module_prefix.to_string() + x.as_str() + "__doc__"))
{
Some((x.to_string(), d.to_string()))
} else {
None
}
None
})
.collect::<HashMap<_, _>>();
*EXPORTED_IDENTIFIERS.identifiers.write().unwrap() = exported;
*EXPORTED_IDENTIFIERS.docs.write().unwrap() = docs;
} else {
panic!("Unable to parse exported identifiers from helix module!")

@ -45,6 +45,9 @@ log = "~0.4"
which = "4.4"
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]
clipboard-win = { version = "4.5", features = ["std"] }

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

Loading…
Cancel
Save