problem matcher doesn't work with contextual errors
There is a problem matcher for ocamlc defined in package.json: https://github.com/ocamllabs/vscode-ocaml-platform/blob/632f4e8eb5ae71cdd3473a704580a7c1cb550a31/package.json#L73-L94
I tried to use it in a project with such a task:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "compile",
"type": "shell",
"command": "opam exec -- dune build",
"group": "build",
"problemMatcher": "$ocamlc"
}
]
}
When running the task (Tasks: run task -> compile), my build is launched but the errors are not picked up by vscode.
If I change package.json of this extension to this, then it is able to detect the compilation errors. But only the location. It can't detect the severity or the message.
"problemMatchers": [
{
"name": "ocamlc",
"fileLocation": [
"relative",
"${workspaceFolder}"
],
"pattern": {
"regexp": "^\\s*\\bFile\\b\\s*\"(.*)\",\\s*\\bline\\b\\s*(\\d+),\\s*\\bcharacters\\b\\s*(\\d+)-(\\d+)\\s*:\\s*$",
"file": 1,
"line": 2,
"column": 3,
"endColumn": 4
}
}
],
If I make the `pattern' field a list, even with only one element, then it doesn't seem to work. The documentation says that pattern can be a list. So I don't understand where the problem comes from.
Another issue but not as critical, the regexp is not able to handle locations for multi-line errors in ocaml 4.09+.
(flags
(:standard -error-style short))
I found out that if I set the error style to short then the problem matcher works. Maybe two matchers are needed. The current one for short errors. And one that ignores the lines starting with \d+ | or \s+\^ for contextual errors.
I'll try to give it a go if you think it's ok to do that.
I'll try to give it a go if you think it's ok to do that.
Thank you for the detailed issue. This functionality would indeed be useful. Feel free to submit a PR if you get it working.
@Khady were all the problems fixed by https://github.com/ocamllabs/vscode-ocaml-platform/pull/229?
No. It still works only with short errors.