Your extension works really great :)
I have an idea to improve it a little bit. Your extension checks only the currently opened file, because that's how vscode works. Errors, warnings and issues are displayed only for all of the currently opened files.
If you want to check all the files in the project, a script can be run, that checks all the files. For example a command can be created inside the script section in a package.json file. This can be run on the command line to output all errors in the project. Vscode can also run this scripts and check its output. It uses a matcher to translate a line of output into an error, which is displayed in the Problems view.
So now the Problems view is populated with errors found in all files. If I open a file with an error, your extension kicks in and adds additional errors, usually the same errors as the errors, which are already present. From my understanding, vscode is able to merge these errors if the extension adds a source to its diagnostic messages and if an owner is configured in the problem matcher, that matches the source.
You can check the owner of an error by going to the problems view, right clicking an error, copying it, pasting it in an editor and looking at the owner property. You will see, that your extension has generated name by now.
My matcher for the compact output looks like this:
"problemMatcher": {
"owner": "",
"fileLocation": [
"relative",
"${workspaceFolder}"
],
"source": "htmlhint",
"pattern": {
"regexp": "^(.+?):\\sline\\s(\\d+),\\scol\\s(\\d+),\\s(\\w+?)\\s-\\s([^(]*\\((\\S+)\\))$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5,
"code": 6
}
}
This works with the Code Spell Checker extension. My guess is, that it adds its owner here: https://github.com/Jason-Rev/vscode-spell-checker/blob/56c9e68cb0057bded8016d5b9c09276074b5ecb5/server/src/validator.ts#L53 The source attribute seems to be added as owner in the problems view.
Could you be so kind to add an owner to diagnostics, so that the Problems view does not contain duplicates anymore?
Cheers,
Thomas