diff options
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 17 | ||||
-rw-r--r-- | editors/code/package.json | 5 | ||||
-rw-r--r-- | editors/code/src/main.ts | 2 |
3 files changed, 15 insertions, 9 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 04f5bb473..b6a015790 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -120,12 +120,10 @@ impl Config { | |||
120 | set(value, "/withSysroot", &mut self.with_sysroot); | 120 | set(value, "/withSysroot", &mut self.with_sysroot); |
121 | set(value, "/featureFlags/lsp.diagnostics", &mut self.publish_diagnostics); | 121 | set(value, "/featureFlags/lsp.diagnostics", &mut self.publish_diagnostics); |
122 | set(value, "/lruCapacity", &mut self.lru_capacity); | 122 | set(value, "/lruCapacity", &mut self.lru_capacity); |
123 | if let Some(watcher) = get::<String>(value, "/files/watcher") { | 123 | self.files.watcher = match get(value, "/files/watcher") { |
124 | self.files.watcher = match watcher.as_str() { | 124 | Some("client") => FilesWatcher::Client, |
125 | "client" => FilesWatcher::Client, | 125 | Some("notify") | _ => FilesWatcher::Notify |
126 | "notify"| _ => FilesWatcher::Notify, | 126 | }; |
127 | } | ||
128 | } | ||
129 | set(value, "/notifications/workspaceLoaded", &mut self.notifications.workspace_loaded); | 127 | set(value, "/notifications/workspaceLoaded", &mut self.notifications.workspace_loaded); |
130 | set(value, "/notifications/cargoTomlNotFound", &mut self.notifications.cargo_toml_not_found); | 128 | set(value, "/notifications/cargoTomlNotFound", &mut self.notifications.cargo_toml_not_found); |
131 | 129 | ||
@@ -144,8 +142,9 @@ impl Config { | |||
144 | } else if let RustfmtConfig::Rustfmt { extra_args } = &mut self.rustfmt { | 142 | } else if let RustfmtConfig::Rustfmt { extra_args } = &mut self.rustfmt { |
145 | set(value, "/rustfmt/extraArgs", extra_args); | 143 | set(value, "/rustfmt/extraArgs", extra_args); |
146 | } | 144 | } |
145 | |||
147 | if let Some(false) = get(value, "/checkOnSave/enable") { | 146 | if let Some(false) = get(value, "/checkOnSave/enable") { |
148 | self.check = None | 147 | self.check = None; |
149 | } else { | 148 | } else { |
150 | if let Some(mut args) = get::<Vec<String>>(value, "/checkOnSave/overrideCommand") { | 149 | if let Some(mut args) = get::<Vec<String>>(value, "/checkOnSave/overrideCommand") { |
151 | if !args.is_empty() { | 150 | if !args.is_empty() { |
@@ -153,7 +152,7 @@ impl Config { | |||
153 | self.check = Some(FlycheckConfig::CustomCommand { | 152 | self.check = Some(FlycheckConfig::CustomCommand { |
154 | command, | 153 | command, |
155 | args, | 154 | args, |
156 | }) | 155 | }); |
157 | } | 156 | } |
158 | 157 | ||
159 | } else if let Some(FlycheckConfig::CargoCommand { command, extra_args, all_targets }) = &mut self.check | 158 | } else if let Some(FlycheckConfig::CargoCommand { command, extra_args, all_targets }) = &mut self.check |
@@ -179,7 +178,7 @@ impl Config { | |||
179 | value.pointer(pointer).and_then(|it| T::deserialize(it).ok()) | 178 | value.pointer(pointer).and_then(|it| T::deserialize(it).ok()) |
180 | } | 179 | } |
181 | 180 | ||
182 | fn set<'a, T: Deserialize<'a> + std::fmt::Debug>(value: &'a serde_json::Value, pointer: &str, slot: &mut T) { | 181 | fn set<'a, T: Deserialize<'a>>(value: &'a serde_json::Value, pointer: &str, slot: &mut T) { |
183 | if let Some(new_value) = get(value, pointer) { | 182 | if let Some(new_value) = get(value, pointer) { |
184 | *slot = new_value | 183 | *slot = new_value |
185 | } | 184 | } |
diff --git a/editors/code/package.json b/editors/code/package.json index 595d6e378..f0d5127d4 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -211,10 +211,12 @@ | |||
211 | }, | 211 | }, |
212 | "rust-analyzer.notifications.workspaceLoaded": { | 212 | "rust-analyzer.notifications.workspaceLoaded": { |
213 | "type": "boolean", | 213 | "type": "boolean", |
214 | "default": true, | ||
214 | "markdownDescription": "Whether to show `workspace loaded` message." | 215 | "markdownDescription": "Whether to show `workspace loaded` message." |
215 | }, | 216 | }, |
216 | "rust-analyzer.notifications.cargoTomlNotFound": { | 217 | "rust-analyzer.notifications.cargoTomlNotFound": { |
217 | "type": "boolean", | 218 | "type": "boolean", |
219 | "default": true, | ||
218 | "markdownDescription": "Whether to show `can't find Cargo.toml` error message" | 220 | "markdownDescription": "Whether to show `can't find Cargo.toml` error message" |
219 | }, | 221 | }, |
220 | "rust-analyzer.cargo.noDefaultFeatures": { | 222 | "rust-analyzer.cargo.noDefaultFeatures": { |
@@ -253,6 +255,7 @@ | |||
253 | "items": { | 255 | "items": { |
254 | "type": "string" | 256 | "type": "string" |
255 | }, | 257 | }, |
258 | "default": [], | ||
256 | "markdownDescription": "Advanced option, fully override the command rust-analyzer uses for formatting." | 259 | "markdownDescription": "Advanced option, fully override the command rust-analyzer uses for formatting." |
257 | }, | 260 | }, |
258 | "rust-analyzer.checkOnSave.enable": { | 261 | "rust-analyzer.checkOnSave.enable": { |
@@ -278,6 +281,7 @@ | |||
278 | "items": { | 281 | "items": { |
279 | "type": "string" | 282 | "type": "string" |
280 | }, | 283 | }, |
284 | "default": [], | ||
281 | "markdownDescription": "Advanced option, fully override the command rust-analyzer uses for checking. The command should include `--message=format=json` or similar option." | 285 | "markdownDescription": "Advanced option, fully override the command rust-analyzer uses for checking. The command should include `--message=format=json` or similar option." |
282 | }, | 286 | }, |
283 | "rust-analyzer.checkOnSave.allTargets": { | 287 | "rust-analyzer.checkOnSave.allTargets": { |
@@ -327,6 +331,7 @@ | |||
327 | }, | 331 | }, |
328 | "rust-analyzer.callInfo.full": { | 332 | "rust-analyzer.callInfo.full": { |
329 | "type": "boolean", | 333 | "type": "boolean", |
334 | "default": true, | ||
330 | "description": "Show function name and docs in parameter hints" | 335 | "description": "Show function name and docs in parameter hints" |
331 | }, | 336 | }, |
332 | "rust-analyzer.highlighting.semanticTokens": { | 337 | "rust-analyzer.highlighting.semanticTokens": { |
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index 4f3b89f44..efd56a84b 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts | |||
@@ -177,6 +177,8 @@ async function bootstrapServer(config: Config, state: PersistentState): Promise< | |||
177 | ); | 177 | ); |
178 | } | 178 | } |
179 | 179 | ||
180 | log.debug("Using server binary at", path); | ||
181 | |||
180 | const res = spawnSync(path, ["--version"], { encoding: 'utf8' }); | 182 | const res = spawnSync(path, ["--version"], { encoding: 'utf8' }); |
181 | log.debug("Checked binary availability via --version", res); | 183 | log.debug("Checked binary availability via --version", res); |
182 | log.debug(res, "--version output:", res.output); | 184 | log.debug(res, "--version output:", res.output); |