Fix issue with host function binding
This commit is contained in:
parent
96c2559d2c
commit
7266dff537
2 changed files with 39 additions and 52 deletions
|
@ -13,12 +13,12 @@ use std::{any::Any, path::PathBuf, sync::Arc};
|
|||
use util::{ResultExt, TryFutureExt};
|
||||
|
||||
pub async fn new_json(executor: Arc<Background>) -> Result<PluginLspAdapter> {
|
||||
let plugin = WasiPluginBuilder::new_with_default_ctx()
|
||||
let plugin = WasiPluginBuilder::new_with_default_ctx()?
|
||||
.host_function("command", |command: String| {
|
||||
// TODO: actual thing
|
||||
std::process::Command::new(command).output().unwrap();
|
||||
Some("Hello".to_string())
|
||||
})
|
||||
})?
|
||||
.init(include_bytes!("../../../../plugins/bin/json_language.wasm"))
|
||||
.await?;
|
||||
PluginLspAdapter::new(plugin, executor).await
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue