Skip to content

Commit 129e9c2

Browse files
committed
update template
1 parent 438bc1b commit 129e9c2

File tree

3 files changed

+35
-7
lines changed

3 files changed

+35
-7
lines changed

Cargo.toml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,23 @@ version = "0.0.0"
55
resolver = "2"
66

77
[target.'cfg(target_os = "wasi")'.dependencies]
8+
# plugin deps
9+
10+
# for unpacking zip
11+
# zip = { version = "0.6", default-features = false, features = ["deflate"] }
12+
13+
# for unpacking tar/gz
14+
# flate2 = { version = "1.0" }
815

916
# default deps for all lapce plugins
1017
anyhow = "1.0"
1118
serde_json = "1.0"
1219
serde = { version = "1.0", features = ["derive"] }
13-
# lapce-plugin = { git = "https://github.com/lapce/lapce-plugin-rust.git", branch = "volt" }
14-
lapce-plugin = { git = "https://github.com/panekj/lapce-plugin-rust.git", branch = "volt" }
20+
lapce-plugin = { git = "https://github.com/lapce/lapce-plugin-rust.git" }
21+
# lapce-plugin = { git = "https://github.com/panekj/lapce-plugin-rust.git", branch = "volt" }
1522

1623
[profile.release]
1724
opt-level = 3
1825
lto = true
1926
codegen-units = 1
27+
strip = true

src/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use anyhow::Result;
22
use lapce_plugin::{
33
psp_types::{
4-
lsp_types::{request::Initialize, DocumentFilter, DocumentSelector, InitializeParams, Url},
4+
lsp_types::{request::Initialize, DocumentFilter, DocumentSelector, InitializeParams, Url, MessageType},
55
Request,
66
},
77
register_plugin, LapcePlugin, VoltEnvironment, PLUGIN_RPC,
@@ -91,15 +91,15 @@ fn initialize(params: InitializeParams) -> Result<()> {
9191

9292
// Plugin working directory
9393
let volt_uri = VoltEnvironment::uri()?;
94-
let server_path = Url::parse(&volt_uri)?.join("[filename]")?;
94+
let server_uri = Url::parse(&volt_uri)?.join("[filename]")?;
9595

9696
// if you want to use server from PATH
97-
// let server_path = Url::parse(&format!("urn:{filename}"))?;
97+
// let server_uri = Url::parse(&format!("urn:{filename}"))?;
9898

9999
// Available language IDs
100100
// https://github.com/lapce/lapce/blob/HEAD/lapce-proxy/src/buffer.rs#L173
101101
PLUGIN_RPC.start_lsp(
102-
server_path,
102+
server_uri,
103103
server_args,
104104
document_selector,
105105
params.initialization_options,
@@ -115,7 +115,7 @@ impl LapcePlugin for State {
115115
Initialize::METHOD => {
116116
let params: InitializeParams = serde_json::from_value(params).unwrap();
117117
if let Err(e) = initialize(params) {
118-
PLUGIN_RPC.stderr(&format!("plugin returned with error: {e}"))
118+
PLUGIN_RPC.window_show_message(MessageType::ERROR, format!("plugin returned with error: {e}"))
119119
}
120120
}
121121
_ => {}

volt.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,23 @@ wasm = "bin/<plugin-name>.wasm"
88
[activation]
99
language = []
1010
workspace-contains = []
11+
12+
[config."volt.serverPath"]
13+
default = ""
14+
description = "Path to custom LSP executable"
15+
16+
# [config."volt.serverArgs"]
17+
# default = []
18+
# description = ""
19+
20+
# [config."lspSettingArray"]
21+
# default = []
22+
# description = ""
23+
24+
# [config."lspSettingString"]
25+
# default = ""
26+
# description = ""
27+
28+
# [config."lspSettingBool"]
29+
# default = false
30+
# description = ""

0 commit comments

Comments
 (0)