Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Fix bug causing lint processes to sometimes not be killed when desired #1791

Merged
merged 2 commits into from Jul 17, 2018
Merged
Changes from 1 commit
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
6 changes: 5 additions & 1 deletion src/goLint.ts
Expand Up @@ -43,6 +43,8 @@ export function lintCode(lintWorkspace?: boolean) {
* @param lintWorkspace If true runs linter in all workspace.
*/
export function goLint(fileUri: vscode.Uri, goConfig: vscode.WorkspaceConfiguration, lintWorkspace?: boolean): Promise<ICheckResult[]> {
epoch++;
let closureEpoch = epoch;
if (tokenSource) {
if (running) {
tokenSource.cancel();
Expand Down Expand Up @@ -113,12 +115,14 @@ export function goLint(fileUri: vscode.Uri, goConfig: vscode.WorkspaceConfigurat
false,
tokenSource.token
).then((result) => {
running = false;
if (closureEpoch === epoch)
running = false;
return result;
});

return lintPromise;
}

let epoch = 0;
let tokenSource: vscode.CancellationTokenSource;
let running = false;