diff --git a/Cargo.toml b/Cargo.toml index d08b3c8..931325f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,15 +5,23 @@ version = "0.0.0" resolver = "2" [target.'cfg(target_os = "wasi")'.dependencies] +# plugin deps + +# for unpacking zip +# zip = { version = "0.6", default-features = false, features = ["deflate"] } + +# for unpacking tar/gz +# flate2 = { version = "1.0" } # default deps for all lapce plugins anyhow = "1.0" serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } -# lapce-plugin = { git = "https://github.com/lapce/lapce-plugin-rust.git", branch = "volt" } -lapce-plugin = { git = "https://github.com/panekj/lapce-plugin-rust.git", branch = "volt" } +lapce-plugin = { git = "https://github.com/lapce/lapce-plugin-rust.git" } +# lapce-plugin = { git = "https://github.com/panekj/lapce-plugin-rust.git", branch = "volt" } [profile.release] opt-level = 3 lto = true codegen-units = 1 +strip = true diff --git a/src/main.rs b/src/main.rs index 9df0641..c7e5455 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ use anyhow::Result; use lapce_plugin::{ psp_types::{ - lsp_types::{request::Initialize, DocumentFilter, DocumentSelector, InitializeParams, Url}, + lsp_types::{request::Initialize, DocumentFilter, DocumentSelector, InitializeParams, Url, MessageType}, Request, }, register_plugin, LapcePlugin, VoltEnvironment, PLUGIN_RPC, @@ -91,15 +91,15 @@ fn initialize(params: InitializeParams) -> Result<()> { // Plugin working directory let volt_uri = VoltEnvironment::uri()?; - let server_path = Url::parse(&volt_uri)?.join("[filename]")?; + let server_uri = Url::parse(&volt_uri)?.join("[filename]")?; // if you want to use server from PATH - // let server_path = Url::parse(&format!("urn:{filename}"))?; + // let server_uri = Url::parse(&format!("urn:{filename}"))?; // Available language IDs // https://github.com/lapce/lapce/blob/HEAD/lapce-proxy/src/buffer.rs#L173 PLUGIN_RPC.start_lsp( - server_path, + server_uri, server_args, document_selector, params.initialization_options, @@ -115,7 +115,7 @@ fn handle_request(&mut self, _id: u64, method: String, params: Value) { Initialize::METHOD => { let params: InitializeParams = serde_json::from_value(params).unwrap(); if let Err(e) = initialize(params) { - PLUGIN_RPC.stderr(&format!("plugin returned with error: {e}")) + PLUGIN_RPC.window_show_message(MessageType::ERROR, format!("plugin returned with error: {e}")) } } _ => {} diff --git a/volt.toml b/volt.toml index a81b27c..201c504 100644 --- a/volt.toml +++ b/volt.toml @@ -8,3 +8,23 @@ wasm = "bin/.wasm" [activation] language = [] workspace-contains = [] + +[config."volt.serverPath"] +default = "" +description = "Path to custom LSP executable" + +# [config."volt.serverArgs"] +# default = [] +# description = "" + +# [config."lspSettingArray"] +# default = [] +# description = "" + +# [config."lspSettingString"] +# default = "" +# description = "" + +# [config."lspSettingBool"] +# default = false +# description = ""