Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add a toggle to disable the dependency explorer #14906

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion editors/code/package.json
Expand Up @@ -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.",
Expand Down Expand Up @@ -2013,7 +2018,7 @@
{
"id": "rustDependencies",
"name": "Rust Dependencies",
"when": "inRustProject"
"when": "inRustProject && config.rust-analyzer.showDependenciesExplorer"
}
]
},
Expand Down
4 changes: 4 additions & 0 deletions editors/code/src/config.ts
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion editors/code/src/ctx.ts
Expand Up @@ -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) {
Expand Down