eclipse-theia/theia

Tasks: Diagnostics from problemMatchers not retrieved via vscode api

Open

#11638 opened on Sep 6, 2022

View on GitHub
 (0 comments) (0 reactions) (0 assignees)TypeScript (18,676 stars) (2,478 forks)batch import
help wantedlanguagestasksvscode

Description

Bug Description:

Diagnostics generated by custom problemMatchers are displayed correctly in the problem view but cannot be retrieved programmatically with vscode api: vscode.languages.getDiagnostics()

Steps to Reproduce:

  1. Open a workspace
  2. Create tasks.json in '.theia' folder at root level with task and command that should generate a diagnostic entry something like:
{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "echo error",
           "command": "echo",
            "args": ["src/main.c:6:11: error: expected ';' before '}' token"],
            "problemMatcher": {
                "label": "matcher test",
                "name": "matcher-test",
                "source": "matcher-test",
                "pattern": {
                    "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error|note):\\s+(.*)$",
                    "file": 1,
                    "line": 2,
                    "column": 3,
                    "severity": 4,
                    "message": 5
                }
            }
        },
    ]
}

If contributing with a command as of a vscode extension, the following: vscode.languages.getDiagnostics(); will not return the diagnostic for the corresponding file entry.

This is probably the root cause of the error lens extension not reflecting diagnostics from a problemMatcher contribution (confirmed this is working as expected in vscode)

Additional Information

  • Operating System: Windows 10
  • Theia Version: 1.27

Contributor guide