Get Wasi working

This commit is contained in:
Isaac Clayton 2022-06-06 08:40:56 +02:00
parent b84948711c
commit 17d15b2f08
9 changed files with 597 additions and 21 deletions

View file

@ -4,28 +4,27 @@ use client::http::HttpClient;
use futures::{future::BoxFuture, FutureExt, StreamExt};
use language::{LanguageServerName, LspAdapter};
use parking_lot::{Mutex, RwLock};
use plugin_runtime::{Runtime, Wasm, WasmPlugin};
use plugin_runtime::{Runtime, Wasi, WasiPlugin};
use serde_json::json;
use smol::fs;
use std::{any::Any, path::PathBuf, sync::Arc};
use util::{ResultExt, TryFutureExt};
pub fn new_json() -> LanguagePluginLspAdapter {
let plugin = WasmPlugin {
let plugin = WasiPlugin {
source_bytes: include_bytes!("../../../../plugins/bin/json_language.wasm").to_vec(),
store_data: (),
};
LanguagePluginLspAdapter::new(plugin)
}
pub struct LanguagePluginLspAdapter {
runtime: Mutex<Wasm<()>>,
runtime: Mutex<Wasi>,
}
impl LanguagePluginLspAdapter {
pub fn new(plugin: WasmPlugin<()>) -> Self {
pub fn new(plugin: WasiPlugin) -> Self {
Self {
runtime: Mutex::new(Wasm::init(plugin).unwrap()),
runtime: Mutex::new(Wasi::init(plugin).unwrap()),
}
}
}