aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/rust-analyzer/src/config.rs15
-rw-r--r--editors/code/package.json11
-rw-r--r--editors/code/src/config.ts2
3 files changed, 22 insertions, 6 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index 2038ef89b..b5dc6f0fa 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -50,6 +50,8 @@ impl Default for LensConfig {
50} 50}
51 51
52impl LensConfig { 52impl LensConfig {
53 pub const NO_LENS: LensConfig = Self { run: false, debug: false, impementations: false };
54
53 pub fn any(&self) -> bool { 55 pub fn any(&self) -> bool {
54 self.impementations || self.runnable() 56 self.impementations || self.runnable()
55 } 57 }
@@ -224,9 +226,16 @@ impl Config {
224 set(value, "/completion/addCallParenthesis", &mut self.completion.add_call_parenthesis); 226 set(value, "/completion/addCallParenthesis", &mut self.completion.add_call_parenthesis);
225 set(value, "/completion/addCallArgumentSnippets", &mut self.completion.add_call_argument_snippets); 227 set(value, "/completion/addCallArgumentSnippets", &mut self.completion.add_call_argument_snippets);
226 set(value, "/callInfo/full", &mut self.call_info_full); 228 set(value, "/callInfo/full", &mut self.call_info_full);
227 set(value, "/lens/run", &mut self.lens.run); 229
228 set(value, "/lens/debug", &mut self.lens.debug); 230 let mut lens_enabled = true;
229 set(value, "/lens/implementations", &mut self.lens.impementations); 231 set(value, "/lens/enable", &mut lens_enabled);
232 if lens_enabled {
233 set(value, "/lens/run", &mut self.lens.run);
234 set(value, "/lens/debug", &mut self.lens.debug);
235 set(value, "/lens/implementations", &mut self.lens.impementations);
236 } else {
237 self.lens = LensConfig::NO_LENS;
238 }
230 239
231 log::info!("Config::update() = {:#?}", self); 240 log::info!("Config::update() = {:#?}", self);
232 241
diff --git a/editors/code/package.json b/editors/code/package.json
index efed4c7f2..38c77533c 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -444,18 +444,23 @@
444 "default": {}, 444 "default": {},
445 "description": "Optional settings passed to the debug engine. Example:\n{ \"lldb\": { \"terminal\":\"external\"} }" 445 "description": "Optional settings passed to the debug engine. Example:\n{ \"lldb\": { \"terminal\":\"external\"} }"
446 }, 446 },
447 "rust-analyzer.lens.enable": {
448 "description": "Whether to show CodeLens in Rust files.",
449 "type": "boolean",
450 "default": true
451 },
447 "rust-analyzer.lens.run": { 452 "rust-analyzer.lens.run": {
448 "description": "Whether to show Run lens.", 453 "markdownDescription": "Whether to show Run lens. Only applies when `#rust-analyzer.lens.enable#` is set.",
449 "type": "boolean", 454 "type": "boolean",
450 "default": true 455 "default": true
451 }, 456 },
452 "rust-analyzer.lens.debug": { 457 "rust-analyzer.lens.debug": {
453 "description": "Whether to show Debug lens.", 458 "markdownDescription": "Whether to show Debug lens. Only applies when `#rust-analyzer.lens.enable#` is set.",
454 "type": "boolean", 459 "type": "boolean",
455 "default": true 460 "default": true
456 }, 461 },
457 "rust-analyzer.lens.implementations": { 462 "rust-analyzer.lens.implementations": {
458 "description": "Whether to show Implementations lens.", 463 "markdownDescription": "Whether to show Implementations lens. Only applies when `#rust-analyzer.lens.enable#` is set.",
459 "type": "boolean", 464 "type": "boolean",
460 "default": true 465 "default": true
461 } 466 }
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index 93d9aa160..ee294fbe3 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -16,6 +16,7 @@ export class Config {
16 "files", 16 "files",
17 "highlighting", 17 "highlighting",
18 "updates.channel", 18 "updates.channel",
19 "lens.enable",
19 "lens.run", 20 "lens.run",
20 "lens.debug", 21 "lens.debug",
21 "lens.implementations", 22 "lens.implementations",
@@ -125,6 +126,7 @@ export class Config {
125 126
126 get lens() { 127 get lens() {
127 return { 128 return {
129 enable: this.get<boolean>("lens.enable"),
128 run: this.get<boolean>("lens.run"), 130 run: this.get<boolean>("lens.run"),
129 debug: this.get<boolean>("lens.debug"), 131 debug: this.get<boolean>("lens.debug"),
130 implementations: this.get<boolean>("lens.implementations"), 132 implementations: this.get<boolean>("lens.implementations"),