-
Notifications
You must be signed in to change notification settings - Fork 29.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support parsing recursive make build output messages from tasks.json #11663
Comments
Here's the tasks.json that I can use to parse the output https://gist.github.com/alessandrod/82f08750ee4c36860b3719765ad6140f |
I looked at the PR and your problem and this is not solvable that way in a general way. The problem is that multi line matchers can only loop on the last match right now. They are made to loop over matches for a single file where usually the first line of the match is the file to be compiles and then all following lines contain errors. I your case a matcher with the line prefix patch will only be able to match one error in a directory. If you have something like this:
then that second error will not be matched because the pattern for the file prefix will not match anymore. The only solution I can think about right now is to have a file location matcher which people could specify of a matcher that looks backwards in the output. The backwards looking I actually want to avoid. This gets pretty complicated and requires that we always keep the whole output. Is it ok to close the PR. If you want I can guide you to a solution for a file prefix matcher. But that is definitely more work. |
That is why if you look at the pattern in tasks.json, I specified:
The |(.*) side essentially makes the "Entering directory..." pattern optional. When it does match, the filePrefix field is updated, else it stays to the last value set. This makes the matcher work for multiple errors in the same file and directory. Perhaps it's not the most elegant solution, but it does work and doesn't need buffering the whole output. If you have a better approach in mind I'm more than happy to hear about it tho! |
I didn't catch this, however I still think that this is not working in a general case. Reason being that the first match must cover 3 lines and all following matches must cover 2 lines and the multi line matcher will not handle that right now. IMO a better and more explicit approach would be something like this (see fileLocation property): {
"name": "make-compile",
"owner": "cpp",
"fileLocation": ["relative", { "regexp" : "^((.*): Entering directory `(.*)'$", "index": 3 }]
"pattern": [
{
"regexp": "CC (.*)"
},
{
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
]
} |
Oh that's true, I had missed that.
I like this, I'll give it a go. |
Great. Let me know if you need help. |
By the way, for compatibility with other tools that parse the
(with same the funny quotes). |
I tried the "fileLocation": ["relative", { "regexp" : "^((.): Entering directory `(.)'$", "index": 3 }] |
Made a program fixpath, it can be found at: It processes the Entering/Leaving directory lines and keeps track of the possible open directories.
|
Cool. |
Is |
No regexp in fileLocation is not supported. |
There is workaround with GNU make output postprocessing: Metrolog/marks@bc7bbc2 |
@dbaeumer Is this issue to cover code-based/dynamic problem matchers that aren't restricted to regex? (eg. if a tool had a JSON output format)? I think so based on other links here, but the title isn't very clear. |
Yes, the solution for that problem will be to allow extensions to parse the output of the terminal themselves without the need of a problem matcher. |
So how was that particular problem fixed? I'm just trying vscode and sure enough, all of my projects use sub-make, as it's a pretty standard pattern for linux development. |
You can probably solve this using |
With |
Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for existing issues here. See also our issue reporting guidelines. Happy Coding! |
Is it? It doesn't work for me. The only thing that seemed like it could work would be to allow regex expressions in the fileLocation setting. On my company's project the Makefile of the project calls a good 50+ other Makefiles and before doing so the scripts change directory so any errors reported by the make command will have broken links due to the fact that it will it will ignore the change in directory. |
In that case, this could be solved by programatic problem matching, which is tracked by #59337 |
I've been using vscode for a couple of days and I'm loving it. I'm a GStreamer (http://gstreamer.freedesktop.org) developer and I would like to be able to build gst with vscode.
GStreamer uses recursive make to build itself. The way it works is that you run make at the root of the project and then make descends in the nested directories and builds the files contained in them (I'm simplifying but that's the gist).
Here's what the build output looks like:
And here's what a build error looks like:
So as you can see the error references a relative filename (vtdec.c) and earlier in the output there's a line specifying in which directory the file is located (/Users/alessandro/src/gst1/head/gst-plugins-bad/sys/applemedia).
vscode already supports relative filenames in problem matchers by letting users specify a static filePrefix to be prefixed to filenames. I'm proposing to add a method for problem matchers to modify the filePrefix as they scan build output.
The text was updated successfully, but these errors were encountered: