aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-04-02 10:55:04 +0100
committerAleksey Kladov <[email protected]>2020-04-02 11:27:09 +0100
commite4cf40a152120c6c3cba1822e56026ae04be63f0 (patch)
tree45d326021aa8f60c35e44442b2349fc9ff1944bb
parent0dde0f92dee7080b91343238ddfa312cc1a7001a (diff)
New config in package.json
-rw-r--r--crates/rust-analyzer/src/config.rs67
-rw-r--r--editors/code/package.json245
2 files changed, 166 insertions, 146 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index f4c154058..b19421c16 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -18,13 +18,13 @@ pub struct Config {
18 pub client_caps: ClientCapsConfig, 18 pub client_caps: ClientCapsConfig,
19 19
20 pub with_sysroot: bool, 20 pub with_sysroot: bool,
21 // TODO: verify that it means what I think it means
21 pub publish_diagnostics: bool, 22 pub publish_diagnostics: bool,
22 pub use_client_watching: bool,
23 // TODO: move to experimental capabilities 23 // TODO: move to experimental capabilities
24 pub vscode_lldb: bool, 24 pub vscode_lldb: bool,
25 pub lru_capacity: Option<usize>, 25 pub lru_capacity: Option<usize>,
26 pub proc_macro_srv: Option<String>, 26 pub proc_macro_srv: Option<String>,
27 pub exclude_globs: Vec<String>, 27 pub files: FilesConfig,
28 pub notifications: NotificationsConfig, 28 pub notifications: NotificationsConfig,
29 29
30 pub cargo: CargoConfig, 30 pub cargo: CargoConfig,
@@ -37,6 +37,18 @@ pub struct Config {
37} 37}
38 38
39#[derive(Debug, Clone)] 39#[derive(Debug, Clone)]
40pub struct FilesConfig {
41 watcher: FilesWatcher,
42 exclude: Vec<String>,
43}
44
45#[derive(Debug, Clone)]
46enum FilesWatcher {
47 Client,
48 Notify,
49}
50
51#[derive(Debug, Clone)]
40pub struct NotificationsConfig { 52pub struct NotificationsConfig {
41 pub workspace_loaded: bool, 53 pub workspace_loaded: bool,
42 pub cargo_toml_not_found: bool, 54 pub cargo_toml_not_found: bool,
@@ -67,11 +79,10 @@ impl Default for Config {
67 79
68 with_sysroot: true, 80 with_sysroot: true,
69 publish_diagnostics: true, 81 publish_diagnostics: true,
70 use_client_watching: false,
71 vscode_lldb: false, 82 vscode_lldb: false,
72 lru_capacity: None, 83 lru_capacity: None,
73 proc_macro_srv: None, 84 proc_macro_srv: None,
74 exclude_globs: Vec::new(), 85 files: FilesConfig { watcher: FilesWatcher::Notify, exclude: Vec::new() },
75 notifications: NotificationsConfig { 86 notifications: NotificationsConfig {
76 workspace_loaded: true, 87 workspace_loaded: true,
77 cargo_toml_not_found: true, 88 cargo_toml_not_found: true,
@@ -112,39 +123,43 @@ impl Config {
112 123
113 set(value, "/withSysroot", &mut self.with_sysroot); 124 set(value, "/withSysroot", &mut self.with_sysroot);
114 set(value, "/featureFlags/lsp.diagnostics", &mut self.publish_diagnostics); 125 set(value, "/featureFlags/lsp.diagnostics", &mut self.publish_diagnostics);
115 set(value, "/useClientWatching", &mut self.use_client_watching);
116 set(value, "/vscodeLldb", &mut self.vscode_lldb); 126 set(value, "/vscodeLldb", &mut self.vscode_lldb);
117 set(value, "/lruCapacity", &mut self.lru_capacity); 127 set(value, "/lruCapacity", &mut self.lru_capacity);
118 set(value, "/excludeGlobs", &mut self.exclude_globs); 128 if let Some(watcher) = get::<String>(value, "/files/watcher") {
119 set(value, "/featureFlags/notifications.workspace-loaded", &mut self.notifications.workspace_loaded); 129 self.files.watcher = match watcher.as_str() {
120 set(value, "/featureFlags/notifications.cargo-toml-not-found", &mut self.notifications.cargo_toml_not_found); 130 "client" => FilesWatcher::Client,
121 131 "notify"| _ => FilesWatcher::Notify,
122 set(value, "/cargoFeatures/noDefaultFeatures", &mut self.cargo.no_default_features); 132 }
123 set(value, "/cargoFeatures/allFeatures", &mut self.cargo.all_features); 133 }
124 set(value, "/cargoFeatures/features", &mut self.cargo.features); 134 set(value, "/notifications/workspaceLoaded", &mut self.notifications.workspace_loaded);
125 set(value, "/cargoFeatures/loadOutDirsFromCheck", &mut self.cargo.load_out_dirs_from_check); 135 set(value, "/notifications/cargoTomlNotFound", &mut self.notifications.cargo_toml_not_found);
136
137 set(value, "/cargo/noDefaultFeatures", &mut self.cargo.no_default_features);
138 set(value, "/cargo/allFeatures", &mut self.cargo.all_features);
139 set(value, "/cargo/features", &mut self.cargo.features);
140 set(value, "/cargo/loadOutDirsFromCheck", &mut self.cargo.load_out_dirs_from_check);
126 if let RustfmtConfig::Rustfmt { extra_args } = &mut self.rustfmt { 141 if let RustfmtConfig::Rustfmt { extra_args } = &mut self.rustfmt {
127 set(value, "/rustfmtArgs", extra_args); 142 set(value, "/rustfmt/extraArgs", extra_args);
128 } 143 }
129 if let Some(false) = get(value, "cargo_watch_enable") { 144 if let Some(false) = get(value, "/checkOnSave/enable") {
130 self.check = None 145 self.check = None
131 } else { 146 } else {
132 if let Some(FlycheckConfig::CargoCommand { command, extra_args, all_targets }) = &mut self.check 147 if let Some(FlycheckConfig::CargoCommand { command, extra_args, all_targets }) = &mut self.check
133 { 148 {
134 set(value, "/cargoWatchArgs", extra_args); 149 set(value, "/checkOnSave/extraArgs", extra_args);
135 set(value, "/cargoWatchCommand", command); 150 set(value, "/checkOnSave/command", command);
136 set(value, "/cargoWatchAllTargets", all_targets); 151 set(value, "/checkOnSave/allTargets", all_targets);
137 } 152 }
138 }; 153 };
139 154
140 set(value, "/inlayHintsType", &mut self.inlay_hints.type_hints); 155 set(value, "/inlayHints/typeHints", &mut self.inlay_hints.type_hints);
141 set(value, "/inlayHintsParameter", &mut self.inlay_hints.parameter_hints); 156 set(value, "/inlayHints/parameterHints", &mut self.inlay_hints.parameter_hints);
142 set(value, "/inlayHintsChaining", &mut self.inlay_hints.chaining_hints); 157 set(value, "/inlayHints/chainingHints", &mut self.inlay_hints.chaining_hints);
143 set(value, "/inlayHintsMaxLength", &mut self.inlay_hints.max_length); 158 set(value, "/inlayHints/maxLength", &mut self.inlay_hints.max_length);
144 set(value, "/featureFlags/completion.enable-postfix", &mut self.completion.enable_postfix_completions); 159 set(value, "/completion/postfix/enable", &mut self.completion.enable_postfix_completions);
145 set(value, "/featureFlags/completion.insertion.add-call-parenthesis", &mut self.completion.add_call_parenthesis); 160 set(value, "/completion/addCallParenthesis", &mut self.completion.add_call_parenthesis);
146 set(value, "/featureFlags/completion.insertion.add-argument-snippets", &mut self.completion.add_call_argument_snippets); 161 set(value, "/completion/addCallArgumentSnippets", &mut self.completion.add_call_argument_snippets);
147 set(value, "/featureFlags/call-info.full", &mut self.call_info_full); 162 set(value, "/callInfo/full", &mut self.call_info_full);
148 163
149 log::info!("Config::update() = {:#?}", self); 164 log::info!("Config::update() = {:#?}", self);
150 165
diff --git a/editors/code/package.json b/editors/code/package.json
index 946145df8..df8adfe0e 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -177,81 +177,71 @@
177 "type": "object", 177 "type": "object",
178 "title": "Rust Analyzer", 178 "title": "Rust Analyzer",
179 "properties": { 179 "properties": {
180 "rust-analyzer.highlighting.semanticTokens": { 180 "rust-analyzer.diagnostics.enable": {
181 "type": "boolean", 181 "type": "boolean",
182 "default": false, 182 "default": true,
183 "description": "Use proposed semantic tokens API for syntax highlighting" 183 "markdownDescription": "Whether to show native rust-analyzer diagnostics."
184 }, 184 },
185 "rust-analyzer.featureFlags": { 185 "rust-analyzer.lruCapacity": {
186 "type": "object", 186 "type": [
187 "default": {}, 187 "null",
188 "description": "Fine grained feature flags to disable annoying features", 188 "integer"
189 "properties": { 189 ],
190 "lsp.diagnostics": { 190 "default": null,
191 "type": "boolean", 191 "minimum": 0,
192 "markdownDescription": "Whether to show diagnostics from `cargo check`" 192 "exclusiveMinimum": true,
193 }, 193 "description": "Number of syntax trees rust-analyzer keeps in memory."
194 "completion.insertion.add-call-parenthesis": {
195 "type": "boolean",
196 "description": "Whether to add parenthesis when completing functions"
197 },
198 "completion.insertion.add-argument-snippets": {
199 "type": "boolean",
200 "description": "Whether to add argument snippets when completing functions"
201 },
202 "completion.enable-postfix": {
203 "type": "boolean",
204 "markdownDescription": "Whether to show postfix snippets like `dbg`, `if`, `not`, etc."
205 },
206 "call-info.full": {
207 "type": "boolean",
208 "description": "Show function name and docs in parameter hints"
209 },
210 "notifications.workspace-loaded": {
211 "type": "boolean",
212 "markdownDescription": "Whether to show `workspace loaded` message"
213 },
214 "notifications.cargo-toml-not-found": {
215 "type": "boolean",
216 "markdownDescription": "Whether to show `can't find Cargo.toml` error message"
217 }
218 }
219 }, 194 },
220 "rust-analyzer.updates.channel": { 195 "rust-analyzer.files.watcher": {
221 "type": "string", 196 "type": "string",
222 "enum": [ 197 "enum": [
223 "stable", 198 "client",
224 "nightly" 199 "notify"
225 ], 200 ],
226 "default": "stable", 201 "default": "client",
227 "markdownEnumDescriptions": [ 202 "description": "Controls file watching implementation."
228 "`\"stable\"` updates are shipped weekly, they don't contain cutting-edge features from VSCode proposed APIs but have less bugs in general",
229 "`\"nightly\"` updates are shipped daily (extension updates automatically by downloading artifacts directly from GitHub), they contain cutting-edge features and latest bug fixes. These releases help us get your feedback very quickly and speed up rust-analyzer development **drastically**"
230 ],
231 "markdownDescription": "Choose `\"nightly\"` updates to get the latest features and bug fixes every day. While `\"stable\"` releases occur weekly and don't contain cutting-edge features from VSCode proposed APIs"
232 }, 203 },
233 "rust-analyzer.updates.askBeforeDownload": { 204 "rust-analyzer.files.exclude": {
205 "type": "array",
206 "items": {
207 "type": "string"
208 },
209 "default": [],
210 "description": "Paths to exclude from analysis."
211 },
212 "rust-analyzer.notifications.workspaceLoaded": {
234 "type": "boolean", 213 "type": "boolean",
235 "default": true, 214 "markdownDescription": "Whether to show `workspace loaded` message."
236 "description": "Whether to ask for permission before downloading any files from the Internet"
237 }, 215 },
238 "rust-analyzer.serverPath": { 216 "rust-analyzer.notifications.cargoTomlNotFound": {
239 "type": [ 217 "type": "boolean",
240 "null", 218 "markdownDescription": "Whether to show `can't find Cargo.toml` error message"
241 "string" 219 },
242 ], 220
243 "default": null, 221 "rust-analyzer.cargo.noDefaultFeatures": {
244 "description": "Path to rust-analyzer executable (points to bundled binary by default). If this is set, then \"rust-analyzer.updates.channel\" setting is not used" 222 "type": "boolean",
223 "default": false,
224 "markdownDescription": "Do not activate the `default` feature"
245 }, 225 },
246 "rust-analyzer.excludeGlobs": { 226 "rust-analyzer.cargo.allFeatures": {
227 "type": "boolean",
228 "default": true,
229 "description": "Activate all available features"
230 },
231 "rust-analyzer.cargo.features": {
247 "type": "array", 232 "type": "array",
248 "items": { 233 "items": {
249 "type": "string" 234 "type": "string"
250 }, 235 },
251 "default": [], 236 "default": [],
252 "description": "Paths to exclude from analysis" 237 "description": "List of features to activate"
253 }, 238 },
254 "rust-analyzer.rustfmtArgs": { 239 "rust-analyzer.cargo.loadOutDirsFromCheck": {
240 "type": "boolean",
241 "default": false,
242 "markdownDescription": "Run `cargo check` on startup to get the correct value for package OUT_DIRs"
243 },
244 "rust-analyzer.rustfmt.extraArgs": {
255 "type": "array", 245 "type": "array",
256 "items": { 246 "items": {
257 "type": "string" 247 "type": "string"
@@ -259,65 +249,30 @@
259 "default": [], 249 "default": [],
260 "description": "Additional arguments to rustfmt" 250 "description": "Additional arguments to rustfmt"
261 }, 251 },
262 "rust-analyzer.useClientWatching": { 252 "rust-analyzer.checkOnSave.enable": {
263 "type": "boolean", 253 "type": "boolean",
264 "default": true, 254 "default": true,
265 "description": "client provided file watching instead of notify watching." 255 "markdownDescription": "Run specified `cargo check` command for diagnostics on save"
266 }, 256 },
267 "rust-analyzer.cargo-watch.enable": { 257 "rust-analyzer.checkOnSave.extraArgs": {
268 "type": "boolean",
269 "default": true,
270 "markdownDescription": "Run specified `cargo-watch` command for diagnostics on save"
271 },
272 "rust-analyzer.cargo-watch.arguments": {
273 "type": "array", 258 "type": "array",
274 "items": { 259 "items": {
275 "type": "string" 260 "type": "string"
276 }, 261 },
277 "markdownDescription": "`cargo-watch` arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo watch -x \"check --features=\"shumway,pdf\"\"` )", 262 "markdownDescription": "Extra arguments for `cargo check`",
278 "default": [] 263 "default": []
279 }, 264 },
280 "rust-analyzer.cargo-watch.command": { 265 "rust-analyzer.checkOnSave.command": {
281 "type": "string",
282 "markdownDescription": "`cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )",
283 "default": "check"
284 },
285 "rust-analyzer.cargo-watch.allTargets": {
286 "type": "boolean",
287 "markdownDescription": "Check all targets and tests (will be passed as `--all-targets`)",
288 "default": true
289 },
290 "rust-analyzer.trace.server": {
291 "type": "string", 266 "type": "string",
292 "scope": "window", 267 "default": "check",
293 "enum": [ 268 "markdownDescription": "Cargo command to use for `cargo check`"
294 "off",
295 "messages",
296 "verbose"
297 ],
298 "enumDescriptions": [
299 "No traces",
300 "Error only",
301 "Full log"
302 ],
303 "default": "off",
304 "description": "Trace requests to the rust-analyzer"
305 }, 269 },
306 "rust-analyzer.trace.extension": { 270 "rust-analyzer.checkOnSave.allTargets": {
307 "description": "Enable logging of VS Code extensions itself",
308 "type": "boolean", 271 "type": "boolean",
309 "default": false 272 "default": true,
310 }, 273 "markdownDescription": "Check all targets and tests (will be passed as `--all-targets`)"
311 "rust-analyzer.lruCapacity": {
312 "type": [
313 "null",
314 "integer"
315 ],
316 "default": null,
317 "minimum": 0,
318 "exclusiveMinimum": true,
319 "description": "Number of syntax trees rust-analyzer keeps in memory"
320 }, 274 },
275
321 "rust-analyzer.inlayHints.typeHints": { 276 "rust-analyzer.inlayHints.typeHints": {
322 "type": "boolean", 277 "type": "boolean",
323 "default": true, 278 "default": true,
@@ -343,29 +298,79 @@
343 "exclusiveMinimum": true, 298 "exclusiveMinimum": true,
344 "description": "Maximum length for inlay hints" 299 "description": "Maximum length for inlay hints"
345 }, 300 },
346 "rust-analyzer.cargoFeatures.noDefaultFeatures": { 301
302 "rust-analyzer.completion.addCallParenthesis": {
347 "type": "boolean", 303 "type": "boolean",
348 "default": false, 304 "default": true,
349 "markdownDescription": "Do not activate the `default` feature" 305 "description": "Whether to add parenthesis when completing functions"
350 }, 306 },
351 "rust-analyzer.cargoFeatures.allFeatures": { 307 "rust-analyzer.completion.addCallArgumentSnippets": {
352 "type": "boolean", 308 "type": "boolean",
353 "default": true, 309 "default": true,
354 "description": "Activate all available features" 310 "description": "Whether to add argument snippets when completing functions"
355 }, 311 },
356 "rust-analyzer.cargoFeatures.features": { 312 "rust-analyzer.completion.postfix.enable": {
357 "type": "array", 313 "type": "boolean",
358 "items": { 314 "default": true,
359 "type": "string" 315 "markdownDescription": "Whether to show postfix snippets like `dbg`, `if`, `not`, etc."
360 }, 316 },
361 "default": [], 317 "rust-analyzer.callInfo.full": {
362 "description": "List of features to activate" 318 "type": "boolean",
319 "description": "Show function name and docs in parameter hints"
363 }, 320 },
364 "rust-analyzer.cargoFeatures.loadOutDirsFromCheck": { 321
322 "rust-analyzer.highlighting.semanticTokens": {
365 "type": "boolean", 323 "type": "boolean",
366 "default": false, 324 "default": false,
367 "markdownDescription": "Run `cargo check` on startup to get the correct value for package OUT_DIRs" 325 "description": "Use proposed semantic tokens API for syntax highlighting"
368 } 326 },
327 "rust-analyzer.updates.channel": {
328 "type": "string",
329 "enum": [
330 "stable",
331 "nightly"
332 ],
333 "default": "stable",
334 "markdownEnumDescriptions": [
335 "`\"stable\"` updates are shipped weekly, they don't contain cutting-edge features from VSCode proposed APIs but have less bugs in general",
336 "`\"nightly\"` updates are shipped daily (extension updates automatically by downloading artifacts directly from GitHub), they contain cutting-edge features and latest bug fixes. These releases help us get your feedback very quickly and speed up rust-analyzer development **drastically**"
337 ],
338 "markdownDescription": "Choose `\"nightly\"` updates to get the latest features and bug fixes every day. While `\"stable\"` releases occur weekly and don't contain cutting-edge features from VSCode proposed APIs"
339 },
340 "rust-analyzer.updates.askBeforeDownload": {
341 "type": "boolean",
342 "default": true,
343 "description": "Whether to ask for permission before downloading any files from the Internet"
344 },
345 "rust-analyzer.serverPath": {
346 "type": [
347 "null",
348 "string"
349 ],
350 "default": null,
351 "description": "Path to rust-analyzer executable (points to bundled binary by default). If this is set, then \"rust-analyzer.updates.channel\" setting is not used"
352 },
353 "rust-analyzer.trace.server": {
354 "type": "string",
355 "scope": "window",
356 "enum": [
357 "off",
358 "messages",
359 "verbose"
360 ],
361 "enumDescriptions": [
362 "No traces",
363 "Error only",
364 "Full log"
365 ],
366 "default": "off",
367 "description": "Trace requests to the rust-analyzer"
368 },
369 "rust-analyzer.trace.extension": {
370 "description": "Enable logging of VS Code extensions itself",
371 "type": "boolean",
372 "default": false
373 },
369 } 374 }
370 }, 375 },
371 "problemPatterns": [ 376 "problemPatterns": [