Skip to content

Commit

Permalink
Show test status until a file is changed
Browse files Browse the repository at this point in the history
Signed-off-by: Oleg Bulatov <oleg@bulatov.me>
  • Loading branch information
dmage committed Feb 26, 2017
1 parent 9a26308 commit d4a9ff3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
25 changes: 1 addition & 24 deletions src/goCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,13 @@ let statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.
statusBarItem.command = 'go.test.showOutput';

export function removeTestStatus(e: vscode.TextDocumentChangeEvent) {
if (e.document.isUntitled || e.document.languageId !== 'go') {
if (e.document.isUntitled) {
return;
}
statusBarItem.hide();
statusBarItem.text = '';
}

export function showHideTestStatus() {
if (!vscode.window.activeTextEditor) {
statusBarItem.hide();
return;
}

let goConfig = vscode.workspace.getConfiguration('go');
if (!goConfig['testOnSave']) {
statusBarItem.hide();
return;
}

let editor = vscode.window.activeTextEditor;
if (editor.document.languageId !== 'go') {
statusBarItem.hide();
return;
}

if (statusBarItem.text !== '') {
statusBarItem.show();
}
}

export interface ICheckResult {
file: string;
line: number;
Expand Down
3 changes: 1 addition & 2 deletions src/goMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { GoDocumentSymbolProvider } from './goOutline';
import { GoSignatureHelpProvider } from './goSignature';
import { GoWorkspaceSymbolProvider } from './goSymbol';
import { GoCodeActionProvider } from './goCodeAction';
import { check, ICheckResult, removeTestStatus, showHideTestStatus } from './goCheck';
import { check, ICheckResult, removeTestStatus } from './goCheck';
import { updateGoPathGoRootFromConfig, setupGoPathAndOfferToInstallTools } from './goInstallTools';
import { GO_MODE } from './goMode';
import { showHideStatus } from './goStatus';
Expand Down Expand Up @@ -77,7 +77,6 @@ export function activate(ctx: vscode.ExtensionContext): void {
vscode.workspace.onDidChangeTextDocument(removeTestStatus, null, ctx.subscriptions);
vscode.window.onDidChangeActiveTextEditor(showHideStatus, null, ctx.subscriptions);
vscode.window.onDidChangeActiveTextEditor(getCodeCoverage, null, ctx.subscriptions);
vscode.window.onDidChangeActiveTextEditor(showHideTestStatus, null, ctx.subscriptions);

setupGoPathAndOfferToInstallTools();
startBuildOnSaveWatcher(ctx.subscriptions);
Expand Down

0 comments on commit d4a9ff3

Please sign in to comment.