Skip to content

Commit

Permalink
Merge branch 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
polinasok committed Feb 23, 2021
2 parents b860a18 + 8272510 commit b3a2611
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '10.x'
node-version: '14.x'

- name: Setup Go
uses: actions/setup-go@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-long-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
version: ['stable', 'insiders']
go: ['1.15', '1.16.0-rc1']
go: ['1.15', '1.16']

steps:
- name: Clone repository
Expand All @@ -26,7 +26,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '10.x'
node-version: '14.x'

- name: Setup Go
uses: actions/setup-go@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-long.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest] # TODO: reenable macos-latest
version: ['stable']
go: ['1.15', '1.16.0-rc1']
go: ['1.15', '1.16']

steps:
- name: Clone repository
Expand All @@ -25,7 +25,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '10.x'
node-version: '14.x'

- name: Setup Go
uses: actions/setup-go@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '10.x'
node-version: '14.x'

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.15'
go-version: '1.16'

- name: Install dependencies
run: npm ci
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -652,9 +652,10 @@
"gdbwire",
"lldbout",
"debuglineerr",
"rpc"
"rpc",
"dap"
],
"description": "Comma separated list of components that should produce debug output. Maps to dlv's `--log-output` flag.",
"description": "Comma separated list of components that should produce debug output. Maps to dlv's `--log-output` flag. Check `dlv log` for details.",
"default": "debugger"
},
"dlvLoadConfig": {
Expand Down Expand Up @@ -830,7 +831,7 @@
"rpc",
"dap"
],
"description": "Comma separated list of components that should produce debug output. Maps to `--log-output` flag. `dap` is only applicable if using dlv-dap",
"description": "Comma separated list of components that should produce debug output. Maps to dlv's `--log-output` flag. Check `dlv log` for details.",
"default": "debugger"
},
"dlvLoadConfig": {
Expand Down
2 changes: 1 addition & 1 deletion src/goLint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function lintCode(scope?: string) {

goLint(documentUri, goConfig, scope)
.then((warnings) => {
handleDiagnosticErrors(editor ? editor.document : null, warnings, lintDiagnosticCollection);
handleDiagnosticErrors(editor ? editor.document : null, warnings, lintDiagnosticCollection, 'go-lint');
diagnosticsStatusBarItem.hide();
})
.catch((err) => {
Expand Down
20 changes: 19 additions & 1 deletion src/goMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ If you would like additional configuration for diagnostics from gopls, please se

buildDiagnosticCollection = vscode.languages.createDiagnosticCollection('go');
ctx.subscriptions.push(buildDiagnosticCollection);
lintDiagnosticCollection = vscode.languages.createDiagnosticCollection('go-lint');
lintDiagnosticCollection = vscode.languages.createDiagnosticCollection(
lintDiagnosticCollectionName(getGoConfig()['lintTool'])
);
ctx.subscriptions.push(lintDiagnosticCollection);
vetDiagnosticCollection = vscode.languages.createDiagnosticCollection('go-vet');
ctx.subscriptions.push(vetDiagnosticCollection);
Expand Down Expand Up @@ -471,6 +473,15 @@ If you would like additional configuration for diagnostics from gopls, please se
});
}
}
if (e.affectsConfiguration('go.lintTool')) {
const lintTool = lintDiagnosticCollectionName(updatedGoConfig['lintTool']);
if (lintDiagnosticCollection && lintDiagnosticCollection.name !== lintTool) {
lintDiagnosticCollection.dispose();
lintDiagnosticCollection = vscode.languages.createDiagnosticCollection(lintTool);
ctx.subscriptions.push(lintDiagnosticCollection);
// TODO: actively maintain our own disposables instead of keeping pushing to ctx.subscription.
}
}
})
);

Expand Down Expand Up @@ -947,3 +958,10 @@ async function getConfiguredGoToolsCommand() {
}
}
}

function lintDiagnosticCollectionName(lintToolName: string) {
if (!lintToolName || lintToolName === 'golint') {
return 'go-lint';
}
return `go-${lintToolName}`;
}
6 changes: 4 additions & 2 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,8 @@ export function runTool(
export function handleDiagnosticErrors(
document: vscode.TextDocument,
errors: ICheckResult[],
diagnosticCollection: vscode.DiagnosticCollection
diagnosticCollection: vscode.DiagnosticCollection,
diagnosticSource?: string
) {
diagnosticCollection.clear();

Expand Down Expand Up @@ -891,7 +892,8 @@ export function handleDiagnosticErrors(
const range = new vscode.Range(error.line - 1, startColumn, error.line - 1, endColumn);
const severity = mapSeverityToVSCodeSeverity(error.severity);
const diagnostic = new vscode.Diagnostic(range, error.msg, severity);
diagnostic.source = diagnosticCollection.name;
// vscode uses source for deduping diagnostics.
diagnostic.source = diagnosticSource || diagnosticCollection.name;
let diagnostics = diagnosticMap.get(canonicalFile);
if (!diagnostics) {
diagnostics = [];
Expand Down

0 comments on commit b3a2611

Please sign in to comment.