Implement periodic yielding using epoch_deadline_async_yield_and_update
This commit is contained in:
parent
170d27b04c
commit
7f11a32364
3 changed files with 39 additions and 15 deletions
|
@ -9,7 +9,7 @@ use std::{any::Any, path::PathBuf, sync::Arc};
|
|||
use util::ResultExt;
|
||||
|
||||
pub async fn new_json(executor: Arc<Background>) -> Result<PluginLspAdapter> {
|
||||
let plugin = PluginBuilder::new_with_default_ctx()?
|
||||
let (plugin, incrementer) = PluginBuilder::new_with_default_ctx()?
|
||||
.host_function_async("command", |command: String| async move {
|
||||
let mut args = command.split(' ');
|
||||
let command = args.next().unwrap();
|
||||
|
@ -25,6 +25,8 @@ pub async fn new_json(executor: Arc<Background>) -> Result<PluginLspAdapter> {
|
|||
include_bytes!("../../../../plugins/bin/json_language.wasm.pre"),
|
||||
)
|
||||
.await?;
|
||||
|
||||
executor.spawn(incrementer).detach();
|
||||
PluginLspAdapter::new(plugin, executor).await
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue