about summary refs log tree commit diff
path: root/editors/code/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-05-26 16:49:13 +0000
committerbors <bors@rust-lang.org>2023-05-26 16:49:13 +0000
commit08f0c299548dde3fd4421e10d2d27ec33e9b644e (patch)
tree05364c9f95f833f7031a4c3b610a874348c6edae /editors/code/src
parent6bca9f2aac0b81da969dcf654f2e38c5f1546c26 (diff)
parent7dfef85be64a574577a2b7fe4d169e42503f0297 (diff)
downloadrust-08f0c299548dde3fd4421e10d2d27ec33e9b644e.tar.gz
rust-08f0c299548dde3fd4421e10d2d27ec33e9b644e.zip
Auto merge of #14906 - davidbarsky:davidbarsky/add-option-to-disable-explorer, r=Veykril
fix: add a toggle to disable the dependency explorer

For common uses of non-Cargo build systems with rust-analyzer, the dependency view isn't particularly helpful because there isn't a Cargo.toml present for dependencies or the dependencies are part of the current workspace.

Speaking from the perspective of a user of `rust-project.json`, I'd prefer to have this feature disabled until I can add a field to `Crate` that defines the location of a build file (e.g., a `BUCK`) file, which would allow for removing the "search for a Cargo.toml in parent directories of a crate root" behavior that exists in a few places (I've opened [an issue](https://github.com/rust-lang/cargo/issues/12187) on Cargo to request this data from `cargo-metadata`).
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/config.ts4
-rw-r--r--editors/code/src/ctx.ts5
2 files changed, 8 insertions, 1 deletions
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) {