fix: add a toggle to disable the dependency explorer.

This commit is contained in:
David Barsky 2023-05-26 11:50:07 -04:00
parent eee6872647
commit 7dfef85be6
3 changed files with 14 additions and 2 deletions

View file

@ -465,6 +465,11 @@
"default": true,
"type": "boolean"
},
"rust-analyzer.showDependenciesExplorer": {
"markdownDescription": "Whether to show the dependencies view.",
"default": true,
"type": "boolean"
},
"$generated-start": {},
"rust-analyzer.assist.emitMustUse": {
"markdownDescription": "Whether to insert #[must_use] when generating `as_` methods\nfor enum variants.",
@ -2013,7 +2018,7 @@
{
"id": "rustDependencies",
"name": "Rust Dependencies",
"when": "inRustProject"
"when": "inRustProject && config.rust-analyzer.showDependenciesExplorer"
}
]
},

View file

@ -284,6 +284,10 @@ export class Config {
get useRustcErrorCode() {
return this.get<boolean>("diagnostics.useRustcErrorCode");
}
get showDependenciesExplorer() {
return this.get<boolean>("showDependenciesExplorer");
}
}
// the optional `cb?` parameter is meant to be used to add additional

View file

@ -263,7 +263,10 @@ export class Ctx {
}
await client.start();
this.updateCommands();
this.prepareTreeDependenciesView(client);
if (this.config.showDependenciesExplorer) {
this.prepareTreeDependenciesView(client);
}
}
private prepareTreeDependenciesView(client: lc.LanguageClient) {