mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-19 10:29:35 +03:00
Start moving code from Zed to plugin
This commit is contained in:
parent
7dd3114a7a
commit
b84948711c
@ -10,7 +10,13 @@ use smol::fs;
|
|||||||
use std::{any::Any, path::PathBuf, sync::Arc};
|
use std::{any::Any, path::PathBuf, sync::Arc};
|
||||||
use util::{ResultExt, TryFutureExt};
|
use util::{ResultExt, TryFutureExt};
|
||||||
|
|
||||||
pub fn new_json() {}
|
pub fn new_json() -> LanguagePluginLspAdapter {
|
||||||
|
let plugin = WasmPlugin {
|
||||||
|
source_bytes: include_bytes!("../../../../plugins/bin/json_language.wasm").to_vec(),
|
||||||
|
store_data: (),
|
||||||
|
};
|
||||||
|
LanguagePluginLspAdapter::new(plugin)
|
||||||
|
}
|
||||||
|
|
||||||
pub struct LanguagePluginLspAdapter {
|
pub struct LanguagePluginLspAdapter {
|
||||||
runtime: Mutex<Wasm<()>>,
|
runtime: Mutex<Wasm<()>>,
|
||||||
@ -47,14 +53,12 @@ impl LspAdapter for LanguagePluginLspAdapter {
|
|||||||
self.runtime.lock().call("fetch_latest_server_version", ());
|
self.runtime.lock().call("fetch_latest_server_version", ());
|
||||||
|
|
||||||
async move {
|
async move {
|
||||||
if let Ok((language_version, server_version)) = versions {
|
versions.map(|(language_version, server_version)| {
|
||||||
Ok(Box::new(Versions {
|
Box::new(Versions {
|
||||||
language_version,
|
language_version,
|
||||||
server_version,
|
server_version,
|
||||||
}) as Box<_>)
|
}) as Box<_>
|
||||||
} else {
|
})
|
||||||
panic!()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.boxed()
|
.boxed()
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
use plugin::prelude::*;
|
use plugin::prelude::*;
|
||||||
|
|
||||||
#[bind]
|
#[bind]
|
||||||
pub fn add(a: (f64, f64)) -> f64 {
|
pub fn name(_: ()) -> &'static str {
|
||||||
a.0 + a.1
|
"vscode-json-languageserver"
|
||||||
|
}
|
||||||
|
|
||||||
|
#[bind]
|
||||||
|
pub fn server_args(_: ()) -> Vec<String> {
|
||||||
|
vec!["--stdio".into()]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user