mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Add "rust-analyzer.lens.enable"
This commit is contained in:
parent
3d445256fe
commit
78817a3194
3 changed files with 22 additions and 6 deletions
|
@ -50,6 +50,8 @@ impl Default for LensConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LensConfig {
|
impl LensConfig {
|
||||||
|
pub const NO_LENS: LensConfig = Self { run: false, debug: false, impementations: false };
|
||||||
|
|
||||||
pub fn any(&self) -> bool {
|
pub fn any(&self) -> bool {
|
||||||
self.impementations || self.runnable()
|
self.impementations || self.runnable()
|
||||||
}
|
}
|
||||||
|
@ -224,9 +226,16 @@ impl Config {
|
||||||
set(value, "/completion/addCallParenthesis", &mut self.completion.add_call_parenthesis);
|
set(value, "/completion/addCallParenthesis", &mut self.completion.add_call_parenthesis);
|
||||||
set(value, "/completion/addCallArgumentSnippets", &mut self.completion.add_call_argument_snippets);
|
set(value, "/completion/addCallArgumentSnippets", &mut self.completion.add_call_argument_snippets);
|
||||||
set(value, "/callInfo/full", &mut self.call_info_full);
|
set(value, "/callInfo/full", &mut self.call_info_full);
|
||||||
|
|
||||||
|
let mut lens_enabled = true;
|
||||||
|
set(value, "/lens/enable", &mut lens_enabled);
|
||||||
|
if lens_enabled {
|
||||||
set(value, "/lens/run", &mut self.lens.run);
|
set(value, "/lens/run", &mut self.lens.run);
|
||||||
set(value, "/lens/debug", &mut self.lens.debug);
|
set(value, "/lens/debug", &mut self.lens.debug);
|
||||||
set(value, "/lens/implementations", &mut self.lens.impementations);
|
set(value, "/lens/implementations", &mut self.lens.impementations);
|
||||||
|
} else {
|
||||||
|
self.lens = LensConfig::NO_LENS;
|
||||||
|
}
|
||||||
|
|
||||||
log::info!("Config::update() = {:#?}", self);
|
log::info!("Config::update() = {:#?}", self);
|
||||||
|
|
||||||
|
|
|
@ -444,18 +444,23 @@
|
||||||
"default": {},
|
"default": {},
|
||||||
"description": "Optional settings passed to the debug engine. Example:\n{ \"lldb\": { \"terminal\":\"external\"} }"
|
"description": "Optional settings passed to the debug engine. Example:\n{ \"lldb\": { \"terminal\":\"external\"} }"
|
||||||
},
|
},
|
||||||
|
"rust-analyzer.lens.enable": {
|
||||||
|
"description": "Whether to show CodeLens in Rust files.",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
"rust-analyzer.lens.run": {
|
"rust-analyzer.lens.run": {
|
||||||
"description": "Whether to show Run lens.",
|
"markdownDescription": "Whether to show Run lens. Only applies when `#rust-analyzer.lens.enable#` is set.",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": true
|
"default": true
|
||||||
},
|
},
|
||||||
"rust-analyzer.lens.debug": {
|
"rust-analyzer.lens.debug": {
|
||||||
"description": "Whether to show Debug lens.",
|
"markdownDescription": "Whether to show Debug lens. Only applies when `#rust-analyzer.lens.enable#` is set.",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": true
|
"default": true
|
||||||
},
|
},
|
||||||
"rust-analyzer.lens.implementations": {
|
"rust-analyzer.lens.implementations": {
|
||||||
"description": "Whether to show Implementations lens.",
|
"markdownDescription": "Whether to show Implementations lens. Only applies when `#rust-analyzer.lens.enable#` is set.",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": true
|
"default": true
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ export class Config {
|
||||||
"files",
|
"files",
|
||||||
"highlighting",
|
"highlighting",
|
||||||
"updates.channel",
|
"updates.channel",
|
||||||
|
"lens.enable",
|
||||||
"lens.run",
|
"lens.run",
|
||||||
"lens.debug",
|
"lens.debug",
|
||||||
"lens.implementations",
|
"lens.implementations",
|
||||||
|
@ -125,6 +126,7 @@ export class Config {
|
||||||
|
|
||||||
get lens() {
|
get lens() {
|
||||||
return {
|
return {
|
||||||
|
enable: this.get<boolean>("lens.enable"),
|
||||||
run: this.get<boolean>("lens.run"),
|
run: this.get<boolean>("lens.run"),
|
||||||
debug: this.get<boolean>("lens.debug"),
|
debug: this.get<boolean>("lens.debug"),
|
||||||
implementations: this.get<boolean>("lens.implementations"),
|
implementations: this.get<boolean>("lens.implementations"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue