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

Duplicate diagnostics when running a task with the $go problemMatcher #2100

Closed
@segevfiner

Description

Steps to Reproduce

  1. Build any go package, when go.buildOnSave is enabled, with the following task definition:
{
    "label": "build",
    "type": "shell",
    "command": "go build -v",
    "problemMatcher": "$go",
    "group": {
        "kind": "build",
        "isDefault": true
    }
}
  1. Observe the duplicate errors.

image

Analysis

VS Code de-duplicates diagnostics based on their owner. For tasks this is set in the problemMatcher (The go problem matcher is defined here: vscode/src/vs/workbench/parts/tasks/common/problemMatcher.ts:1798-1807). While for extensions this is the name of the DiagnosticCollection (See vscode/src/vs/workbench/api/node/extHostDiagnostics.ts:258). In order for diagnostics generated by go.buildOnSave to be de-duplicated with diagnostics generated by tasks we need to use a single DiagnosticCollection, and name it go.

P.S. We should also set Diagnostic.source. It should be just go for build tasks, and probably the name of the linter, for linters. I will open a separate issue for this. EDIT: Created #2101

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions