You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Problem matcher can't support absolute and relative filenames at the same time #449
I have a problem matcher that works on the output of the Delphi compller. Sometimes it gives relative and absolute file names at the same time. When I set "fileLocation": ["absolute"] the messages having relative paths can't be opened. When I set "fileLocation": ["relative", "${workspaceRoot}"] the messages having absolute paths can't be opened anymore.
Is it possible to define a a problem matcher that uses relative paths as long as the mentioned file exists and uses absolute paths as a fallback mode?
Reacted by Jan Niklas Hasse, Robin Wenglewski, Oscar Lim, Ilia Ki, JasonKleban, Tara, Sean McManus, jonatangoebel, Jens Fischer, mg and 10 more
The idea was to file path autodetection support. Something like:
"fileLocation": ["autoDetect"]
It would check whether a path appears to be relative or absolute (e.g. starts with / or a drive letter). Would that help in your case.
Reacted by Jan Niklas Hasse, Jens Fischer, Drew R, Oscar Lim, Mark Pitchless, Ron Pressler, mg, Joel Spadin, Felipe Cock Martínez, Nad Alaba and 1 more
I am hitting the same issue using C++ with clang. Sometimes error paths are reported as relative and sometimes are absolute.
The fileLocation could be a list of paths, with absolute and relative specification, just like a C++ include path list.
Same issue with mbed compiler, it generally just prints the filename that errors are in, it would be great if it could file the file in the browse path or let me supply a list of paths to search in.
I would like to up this one more, this is quite a show stopper as there is no real workaround once you have an absolute path, for instance on a different drive.
For now, we found a workaround for this in the Haxe extension: provide two problem matchers, one of them being listed first to have priority and having a pattern that only matches against absolute paths ((?=[a-zA-Z]:|\\/)). This seems to work nicely.
The only annoying part is that "Configure Default Build Task" copy-pastes the problem matchers of contributed tasks into tasks.json, so users who have already done that in the past will have to add the additional problem matcher manually.
MSVC sometimes outputs paths in relative paths, and sometimes in absolute path. I would like the problem matchers to try harder to find files. If the problemMatcher is upgraded I prefer there to be no "relative" or "absolute" option and "fileLocation" to always be a path and "autoDetect" is the only option. Autodetection I can't imagine being too heavy just test if the file exists if not try as absolute, if not then try relative to project, if that fails try relative to build and if that fails then nothing much can be done. That will cover majority of the cases and will allow having it much simpler and not requiring to specify a fileLocation.
I have the same issue with problem matcher, I uninstalled all extensions except Platformio.io and C/C++ (Microsoft), but the links in the problem matcher are still broken because the path is duplicated. Unable to open 'Datalogger.ino': File not found (file:///home/felipe/Documents/PlatformIO/Projects/Bluepill_Datalogger/home/felipe/Documents/PlatformIO/Projects/Bluepill_Datalogger/src/Datalogger.ino).
I've tied to clean compile with these three settings and the wrong path managing persists : "problemMatcher": { "base":"$platformio", "fileLocation": ["relative", "/"] // "fileLocation": ["relative", "${workspaceRoot}"] // "fileLocation": "absolute"
I hope you could fix this bug. Thanks for listening.
Nice. Looking at the commit c541056 it looks like fileLocation documentation hasn't been updated "AutoDetect" though. Will this value be documented and available?
We usually don't write documentation until we've release a feature. I'll add documentation around the time when autoDetect is part of a release. You can try it the insiders build soon.
Activity
dbaeumer commentedon Nov 23, 2015
The idea was to file path autodetection support. Something like:
"fileLocation": ["autoDetect"]
It would check whether a path appears to be relative or absolute (e.g. starts with / or a drive letter). Would that help in your case.
Wosi commentedon Nov 23, 2015
That would solve my problem, yes.
Gama11 commentedon Aug 25, 2016
We need this feature for vshaxe (https://github.com/vshaxe/vshaxe) as well - the Haxe compiler reports errors with absolute paths if the error is in a haxelib somewhere outside of the current project, and relative otherwise.
9il commentedon Jun 4, 2017
It is also required by Dlang compilers.
Pagghiu commentedon Feb 20, 2018
I am hitting the same issue using C++ with clang. Sometimes error paths are reported as relative and sometimes are absolute.
The fileLocation could be a list of paths, with absolute and relative specification, just like a C++ include path list.
andrewleech commentedon Feb 23, 2018
Same issue with mbed compiler, it generally just prints the filename that errors are in, it would be great if it could file the file in the browse path or let me supply a list of paths to search in.
ncannasse commentedon Apr 8, 2018
I would like to up this one more, this is quite a show stopper as there is no real workaround once you have an absolute path, for instance on a different drive.
dbaeumer commentedon Apr 9, 2018
Would anyone like to work on a PR for it.
Gama11 commentedon Apr 9, 2018
For now, we found a workaround for this in the Haxe extension: provide two problem matchers, one of them being listed first to have priority and having a pattern that only matches against absolute paths (
(?=[a-zA-Z]:|\\/)). This seems to work nicely.The only annoying part is that "Configure Default Build Task" copy-pastes the problem matchers of contributed tasks into
tasks.json, so users who have already done that in the past will have to add the additional problem matcher manually.graph commentedon Aug 31, 2018
MSVC sometimes outputs paths in relative paths, and sometimes in absolute path. I would like the problem matchers to try harder to find files. If the problemMatcher is upgraded I prefer there to be no "relative" or "absolute" option and "fileLocation" to always be a path and "autoDetect" is the only option. Autodetection I can't imagine being too heavy just test if the file exists if not try as absolute, if not then try relative to project, if that fails try relative to build and if that fails then nothing much can be done. That will cover majority of the cases and will allow having it much simpler and not requiring to specify a fileLocation.
felipecock commentedon Mar 7, 2019
I have the same issue with problem matcher, I uninstalled all extensions except Platformio.io and C/C++ (Microsoft), but the links in the problem matcher are still broken because the path is duplicated.
Unable to open 'Datalogger.ino': File not found (file:///home/felipe/Documents/PlatformIO/Projects/Bluepill_Datalogger/home/felipe/Documents/PlatformIO/Projects/Bluepill_Datalogger/src/Datalogger.ino).I've tied to clean compile with these three settings and the wrong path managing persists :
"problemMatcher": { "base":"$platformio", "fileLocation": ["relative", "/"] // "fileLocation": ["relative", "${workspaceRoot}"] // "fileLocation": "absolute"I hope you could fix this bug. Thanks for listening.
Related threads:
microsoft/vscode-cpptools#1915
dbaeumer commentedon Jun 4, 2019
Alex Ross (@alexr00) thanks for addressing this.
graph commentedon Jun 4, 2019
Nice. Looking at the commit c541056 it looks like
fileLocationdocumentation hasn't been updated "AutoDetect" though. Will this value be documented and available?alexr00 commentedon Jun 5, 2019
We usually don't write documentation until we've release a feature. I'll add documentation around the time when
autoDetectis part of a release. You can try it the insiders build soon.