diff options
| author | David Barsky <me@davidbarsky.com> | 2023-05-26 11:50:07 -0400 |
|---|---|---|
| committer | David Barsky <me@davidbarsky.com> | 2023-05-26 11:50:07 -0400 |
| commit | 7dfef85be64a574577a2b7fe4d169e42503f0297 (patch) | |
| tree | 8dec8b68f7bfb5f0df13fabc09414e24c39d0e45 | |
| parent | eee6872647fff3d168149e015264673c44b5b062 (diff) | |
| download | rust-7dfef85be64a574577a2b7fe4d169e42503f0297.tar.gz rust-7dfef85be64a574577a2b7fe4d169e42503f0297.zip | |
fix: add a toggle to disable the dependency explorer.
| -rw-r--r-- | editors/code/package.json | 7 | ||||
| -rw-r--r-- | editors/code/src/config.ts | 4 | ||||
| -rw-r--r-- | editors/code/src/ctx.ts | 5 |
3 files changed, 14 insertions, 2 deletions
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<boolean>("diagnostics.useRustcErrorCode"); } + + get showDependenciesExplorer() { + return this.get<boolean>("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) { |
