diff --git a/editors/code/package.json b/editors/code/package.json index 96d63b42393..390508b883e 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -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" } ] }, diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index d6b8cc7a56a..c6d2bcc2b2a 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -284,6 +284,10 @@ export class Config { get useRustcErrorCode() { return this.get("diagnostics.useRustcErrorCode"); } + + get showDependenciesExplorer() { + return this.get("showDependenciesExplorer"); + } } // the optional `cb?` parameter is meant to be used to add additional diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts index 8bed74b88ea..a72b5391ff1 100644 --- a/editors/code/src/ctx.ts +++ b/editors/code/src/ctx.ts @@ -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) {