Fix resulting errors and introduce functional executor callback

This commit is contained in:
Isaac Clayton 2022-07-13 13:15:12 +02:00
parent 8974b0c490
commit 8b376dd613
2 changed files with 55 additions and 38 deletions

View file

@ -9,9 +9,10 @@ use std::{any::Any, path::PathBuf, sync::Arc};
use util::ResultExt;
pub async fn new_json(executor: Arc<Background>) -> Result<PluginLspAdapter> {
let executor_ref = executor.clone();
let plugin =
PluginBuilder::new_epoch_with_default_ctx(PluginYield::default_epoch(), |future| {
executor.spawn(future).detach()
PluginBuilder::new_epoch_with_default_ctx(PluginYield::default_epoch(), move |future| {
executor_ref.spawn(future).detach()
})?
.host_function_async("command", |command: String| async move {
let mut args = command.split(' ');