more integration

pull/8675/merge^2
mattwparas 2 years ago
parent ba1a38d497
commit 15886dec3f

12
Cargo.lock generated

@ -500,17 +500,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "custom-commands"
version = "0.1.0"
dependencies = [
"anyhow",
"helix-core",
"helix-term",
"helix-view",
"steel-core",
]
[[package]] [[package]]
name = "cxx" name = "cxx"
version = "1.0.94" version = "1.0.94"
@ -2662,6 +2651,7 @@ dependencies = [
"thiserror", "thiserror",
"ureq", "ureq",
"weak-table", "weak-table",
"which",
] ]
[[package]] [[package]]

@ -9,7 +9,6 @@ members = [
"helix-loader", "helix-loader",
"helix-vcs", "helix-vcs",
"helix-parsec", "helix-parsec",
"custom-commands",
"xtask", "xtask",
] ]

@ -25,7 +25,7 @@ use crate::{
compositor::{self, Component, Compositor}, compositor::{self, Component, Compositor},
job::{self, Callback}, job::{self, Callback},
keymap::{merge_keys, Keymap}, keymap::{merge_keys, Keymap},
ui::{self, overlay::overlaid, Popup, PromptEvent}, ui::{self, menu::Item, overlay::overlaid, Popup, PromptEvent},
}; };
use super::{ use super::{
@ -127,6 +127,23 @@ impl StatusLineMessage {
} }
} }
impl Item for SteelVal {
type Data = ();
// TODO: This shouldn't copy the data every time
fn format(&self, _data: &Self::Data) -> tui::widgets::Row {
let formatted = self.to_string();
formatted
.strip_prefix("\"")
.unwrap_or(&formatted)
.strip_suffix("\"")
.unwrap_or(&formatted)
.to_owned()
.into()
}
}
/// In order to send events from the engine back to the configuration, we can created a shared /// In order to send events from the engine back to the configuration, we can created a shared
/// queue that the engine and the config push and pull from. Alternatively, we could use a channel /// queue that the engine and the config push and pull from. Alternatively, we could use a channel
/// directly, however this was easy enough to set up. /// directly, however this was easy enough to set up.
@ -547,7 +564,7 @@ impl Component for BoxDynComponent {
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();
println!("Loading engine!"); log::info!("Loading engine!");
// Load native modules from the directory. Another idea - have a separate dlopen loading system // Load native modules from the directory. Another idea - have a separate dlopen loading system
// in place that does not use the type id, and instead we generate the module after the dylib // in place that does not use the type id, and instead we generate the module after the dylib
@ -620,6 +637,8 @@ fn configure_engine() -> std::rc::Rc<std::cell::RefCell<steel::steel_vm::engine:
}, },
); );
engine.register_fn("Picker::new", |values: Vec<String>| todo!());
// engine.register_fn( // engine.register_fn(
// "Picker::new", // "Picker::new",
// |contents: &mut Wrapped // |contents: &mut Wrapped

@ -2905,12 +2905,12 @@ pub(super) fn command_mode(cx: &mut Context) {
// TODO: @Matt - Add completion for added scripting commands here // TODO: @Matt - Add completion for added scripting commands here
// Handle typable commands // Handle typable commands
// Register callback functions here - if the prompt event is validate,
// Grab the function run and run through the hooks.
if let Some(cmd) = typed::TYPABLE_COMMAND_MAP.get(parts[0]) { if let Some(cmd) = typed::TYPABLE_COMMAND_MAP.get(parts[0]) {
let shellwords = Shellwords::from(input); let shellwords = Shellwords::from(input);
let args = shellwords.words(); let args = shellwords.words();
log::warn!("calling builtin: {}...", parts[0]);
if let Err(e) = (cmd.fun)(cx, &args[1..], event) { if let Err(e) = (cmd.fun)(cx, &args[1..], event) {
cx.editor.set_error(format!("{}", e)); cx.editor.set_error(format!("{}", e));
} }

Loading…
Cancel
Save