-
Notifications
You must be signed in to change notification settings - Fork 646
Duplicate diagnostics when running a task with the $go problemMatcher #2100
Comments
I wonder if the right way to handle this is to define a buildDiagnosticCollection = vscode.languages.createDiagnosticCollection('go');
lintDiagnosticCollection = vscode.languages.createDiagnosticCollection('go-lint');
vetDiagnosticCollection = vscode.languages.createDiagnosticCollection('go-vet');
testDiagnosticCollection = vscode.languages.createDiagnosticCollection('go-test'); That way we only clear the collection when running the corresponding type of tool, and we can correctly set the owner of build errors to |
Also set setting diagnostic.source Fixes microsoft#2100
Also set setting diagnostic.source Fixes microsoft#2100, fixes microsoft#2101
If we had a task definition that runs the linter, then we would still have the duplicate problem situation, right? Is there any situation where one would want both the build/lint/vet via tasks as well as build/lint/run via the save operation? |
You wouldn't have the problem if you specify that the The current This makes it likely for the user to want to configure a task that runs Another situation is a user defining a task that runs the linter on a larger scope than that configured for the automatic on save linting. As such, it seems to me that that's the way |
This would require the user to be aware of this and know how to define a new problem matcher. We can solve the second part of the problem by contributing the |
They kinda have to know how to do that to hit this issue in the first place. 😜 The owner thing is not that well explained in the docs though: Defining a problem matcher, and is only really explained in the tasks.json schema.
Yeah. We might have to contribute multiple problem matchers in case the linters have different patterns. Just with the same |
The fix for this is now available in the latest version of the Go extension (0.8.0) |
Steps to Reproduce
go.buildOnSave
is enabled, with the following task definition:Analysis
VS Code de-duplicates diagnostics based on their
owner
. For tasks this is set in theproblemMatcher
(Thego
problem matcher is defined here: vscode/src/vs/workbench/parts/tasks/common/problemMatcher.ts:1798-1807). While for extensions this is the name of theDiagnosticCollection
(See vscode/src/vs/workbench/api/node/extHostDiagnostics.ts:258). In order for diagnostics generated bygo.buildOnSave
to be de-duplicated with diagnostics generated by tasks we need to use a singleDiagnosticCollection
, and name itgo
.P.S. We should also set
Diagnostic.source
. It should be justgo
for build tasks, and probably the name of the linter, for linters. I will open a separate issue for this. EDIT: Created #2101The text was updated successfully, but these errors were encountered: