mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-29 10:58:02 +00:00
change config rust-analyzer.statusBar.documentSelector to showStatusBar
This commit is contained in:
parent
fe027d79d2
commit
ed0df3094b
3 changed files with 64 additions and 37 deletions
|
|
@ -13,6 +13,13 @@ export type RunnableEnvCfgItem = {
|
|||
};
|
||||
export type RunnableEnvCfg = Record<string, string> | RunnableEnvCfgItem[];
|
||||
|
||||
type ShowStatusBar =
|
||||
| "always"
|
||||
| "never"
|
||||
| {
|
||||
documentSelector: vscode.DocumentSelector;
|
||||
};
|
||||
|
||||
export class Config {
|
||||
readonly extensionId = "rust-lang.rust-analyzer";
|
||||
configureLang: vscode.Disposable | undefined;
|
||||
|
|
@ -348,8 +355,8 @@ export class Config {
|
|||
return this.get<string>("statusBar.clickAction");
|
||||
}
|
||||
|
||||
get statusBarDocumentSelector() {
|
||||
return this.get<vscode.DocumentSelector>("statusBar.documentSelector");
|
||||
get statusBarShowStatusBar() {
|
||||
return this.get<ShowStatusBar>("statusBar.showStatusBar");
|
||||
}
|
||||
|
||||
get initializeStopped() {
|
||||
|
|
|
|||
|
|
@ -478,14 +478,19 @@ export class Ctx implements RustAnalyzerExtensionApi {
|
|||
}
|
||||
|
||||
private updateStatusBarVisibility(editor: vscode.TextEditor | undefined) {
|
||||
const documentSelector = this.config.statusBarDocumentSelector;
|
||||
if (documentSelector != null) {
|
||||
const showStatusBar = this.config.statusBarShowStatusBar;
|
||||
if (showStatusBar == null || showStatusBar === "never") {
|
||||
this.statusBar.hide();
|
||||
} else if (showStatusBar === "always") {
|
||||
this.statusBar.show();
|
||||
} else {
|
||||
const documentSelector = showStatusBar.documentSelector;
|
||||
if (editor != null && vscode.languages.match(documentSelector, editor.document) > 0) {
|
||||
this.statusBar.show();
|
||||
return;
|
||||
} else {
|
||||
this.statusBar.hide();
|
||||
}
|
||||
}
|
||||
this.statusBar.hide();
|
||||
}
|
||||
|
||||
pushExtCleanup(d: Disposable) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue