Skip to content

Commit 9c29f38

Browse files
committed
feat(volt): update config options
1 parent 2c06b9b commit 9c29f38

File tree

2 files changed

+28
-77
lines changed

2 files changed

+28
-77
lines changed

src/main.rs

+1-35
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fn initialize(params: InitializeParams) -> Result<()> {
4545
scheme: None,
4646
}];
4747

48-
let mut server_args: Vec<String> = vec![string!("--stdio")];
48+
let server_args: Vec<String> = vec![string!("--stdio")];
4949
let mut lapcord_options: Option<Value> = None;
5050
// Check for user specified LSP server path
5151
// ```
@@ -55,40 +55,6 @@ fn initialize(params: InitializeParams) -> Result<()> {
5555
// ```
5656
if let Some(opts) = params.initialization_options.as_ref() {
5757
lapcord_options = opts.get("lapcord").map(|k| k.to_owned());
58-
if let Some(volt) = opts.get("volt") {
59-
if let Some(args) = volt.get("serverArgs") {
60-
if let Some(args) = args.as_array() {
61-
if !args.is_empty() {
62-
server_args = vec![];
63-
}
64-
for arg in args {
65-
if let Some(arg) = arg.as_str() {
66-
server_args.push(arg.to_string());
67-
}
68-
}
69-
}
70-
}
71-
72-
if let Some(server_path) = volt.get("serverPath") {
73-
if let Some(server_path) = server_path.as_str() {
74-
if !server_path.is_empty() {
75-
let server_uri = Url::parse(&format!("urn:{}", server_path))?;
76-
if let Err(e) = PLUGIN_RPC.start_lsp(
77-
server_uri,
78-
server_args,
79-
document_selector,
80-
lapcord_options,
81-
) {
82-
ok!(PLUGIN_RPC.window_show_message(
83-
MessageType::ERROR,
84-
format!("plugin returned with error: {e}")
85-
));
86-
}
87-
return Ok(());
88-
}
89-
}
90-
}
91-
}
9258
}
9359

9460
// Plugin working directory

volt.toml

+27-42
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "dou-lapcord"
22
author = "Dou"
3-
version = "0.0.4"
3+
version = "2.1.0"
44
display-name = "Lapcord"
55
description = "Discord Rich Presence extension for Lapce Editor."
66
wasm = "bin/lapcord.wasm"
@@ -11,63 +11,48 @@ repository = "https://github.com/doupkg/lapcord"
1111
language = []
1212
workspace-contains = ["*"]
1313

14-
[config."volt.serverPath"]
15-
default = ""
16-
description = "Path to custom LSP executable"
17-
18-
[config."volt.serverArgs"]
19-
default = []
20-
description = "Arguments to pass into LSP executable"
21-
22-
[config."lapcord.TimeoutToIdle"]
23-
default = 60000
24-
description = """
25-
Timeout to show idle state
26-
27-
Why?
28-
Lapce does not notify the server when a file is closed, so, auto idle shows idle state after a specific time.
29-
30-
In Millisecons
31-
"""
32-
3314
# Editing
34-
[config."lapcord.editing.state"]
35-
default = "Editing {filename}"
36-
description = "State when EDITING file"
37-
3815
[config."lapcord.editing.details"]
3916
default = ""
40-
description = "Details when EDITING file"
41-
42-
[config."lapcord.editing.showTimestamp"]
43-
default = true
44-
description = "Whether to show or not a timestamp when EDITING file"
17+
description = ""
4518

4619
[config."lapcord.editing.largeImageText"]
4720
default = ""
48-
description = "LargeImage Text when EDITING file"
21+
description = ""
22+
23+
[config."lapcord.editing.showTimestamp"]
24+
default = true
25+
description = ""
4926

5027
[config."lapcord.editing.smallImageText"]
5128
default = ""
52-
description = "SmallImage Text when EDITING file"
29+
description = ""
5330

54-
# Idle
55-
[config."lapcord.idle.state"]
56-
default = "Idle"
57-
description = "State when IDLE"
31+
[config."lapcord.editing.state"]
32+
default = "Editing {filename}"
33+
description = ""
5834

35+
# Idle
5936
[config."lapcord.idle.details"]
6037
default = ""
61-
description = "Details when IDLE"
62-
63-
[config."lapcord.idle.showTimestamp"]
64-
default = true
65-
description = "Whether to show or not a timestamp when IDLE"
38+
description = ""
6639

6740
[config."lapcord.idle.largeImageText"]
6841
default = ""
69-
description = "Text on large image when IDLE"
42+
description = ""
43+
44+
[config."lapcord.idle.showTimestamp"]
45+
default = true
46+
description = ""
7047

7148
[config."lapcord.idle.smallImageText"]
7249
default = ""
73-
description = "Text on small image when IDLE"
50+
description = ""
51+
52+
[config."lapcord.idle.state"]
53+
default = "Idle"
54+
description = ""
55+
56+
[config."lapcord.idle.timeout"]
57+
default = 60
58+
description = "In seconds. Min 15s"

0 commit comments

Comments
 (0)