Skip to content

Commit

Permalink
fix: status bar visibilitiy (#770)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlday authored Sep 22, 2024
1 parent 052da10 commit 85debee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/Linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,11 @@ export class Linter implements CodeActionProvider {

// Editor Changed
public editorChanged(editor: TextEditor | undefined, lint: boolean): void {
if (editor) {
this.documentChanged(editor.document, lint);
} else {
if (!editor) {
this.statusBarManager.hide();
return;
} else {
this.documentChanged(editor.document, lint);
}
}

Expand All @@ -150,7 +151,10 @@ export class Linter implements CodeActionProvider {
document: TextDocument | undefined,
lint: boolean,
): void {
if (document) {
if (!document) {
this.statusBarManager.hide();
return;
} else {
if (this.configManager.isSupportedDocument(document)) {
this.statusBarManager.show();
if (lint) {
Expand All @@ -159,8 +163,6 @@ export class Linter implements CodeActionProvider {
}
this.requestLint(document);
}
} else {
this.statusBarManager.hide();
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ export function activate(context: vscode.ExtensionContext): void {
// Register onDidChangeActiveTextEditor event - request lint
context.subscriptions.push(
vscode.window.onDidChangeActiveTextEditor((editor) => {
linter.editorChanged(editor, configMan.isLintOnChange());
if (editor !== undefined) {
linter.editorChanged(
vscode.window.activeTextEditor,
configMan.isLintOnChange(),
);
}
}),
);

Expand Down

0 comments on commit 85debee

Please sign in to comment.