-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
PROBLEMS pane: file path is not correctly prefixed with forward slash /
#1915
Comments
The messages "Unable to open … File not found" and "use of undeclared identifier" are not from our extension. Do you have another C++ extension installed? This doesn't sound like our issue, right? |
First, please don't close issues in less than 24 hours without giving me an opportunity to respond. Here is the extension I have installed - no other cpp extension. I had already raised an issue with the VSCode team first, and they directed me to you.
Perhaps it isn't your error message, but instead you have a poorly constructed URI. Therefore, the file path would in turn be handed off to some module that would generate such an error message. Is your extension responsible for constructing the URIs? |
If the message doesn't come from our extension, then we didn't construct the URI. Can you provide more details as to how this message was generated? Were you running a task? Were you editing code? What other extensions have you installed? |
Our extension has a problem matcher, which assumes the path is relative to your workspace as you describe. It's currently "by design". We could treat this as a feature request to enable this to work with absolute paths (no one else has asked for this yet though). You could modify the package.json yourself as a workaround for your scenario, by changing the fileLocation to "absolute" (see https://code.visualstudio.com/docs/editor/tasks-appendix ). I'm not sure yet if there's a way to get it detect the absolute path and switch to the correct problem matcher. The code is in our package.json, search for problemMatchers: (https://github.com/Microsoft/vscode-cpptools/blob/master/Extension/package.json ). This part of the extension is open source. |
The ability to auto-detect if a problem path is absolute or relative is being tracked by microsoft/vscode#449 . I have upvoted the issue. However, it sounds like we might be able to workaround the issue via adding an absolute path problem matcher before the relative path one. |
These are all the extensions I have installed... The message is generated when I run a task of I'm running a python script that compiles my project using a makefile. Sorry for the delay, I've been trying to collect better examples, but they are very specific to my work and I haven't found any that are completely free of IP. |
@sean-mcmanus I believe your intuition is right, that they appear to be related to the problem matcher. |
It seems like when we use "make -C" to make on top level, the problem shows. Any update on this problem? |
Note: if you can change the GCC commands themselves, you can fix this issue by using only absolute paths in GCC calls. "command": "g++",
"args": [
"-g",
"-Wall",
// When GCC displays errors, it uses the paths you supply it to show the
// file or the error, even if those paths are relative. However, GCC uses
// absolute paths for errors in system libraries.
// VSCode however, requires all paths in errors to be either relative OR absolute.
// so we append ${workspaceRoot} to the relative paths in this command so that all
// paths are absolute.
// Note: this requires configuring problemmatcher to use absolute paths too.
"${workspaceRoot}/*.cpp",
"-static-libgcc",
"-static-libstdc++",
"-lallegro",
"-lallegro_audio",
"-lallegro_acodec",
"-lallegro_dialog",
"-lallegro_font",
"-lallegro_image",
"-lallegro_primitives",
"-lallegro_ttf",
"-o",
"project.exe"
] and then change the problemmatcher to use absolute paths. "problemMatcher": {
"base": "$gcc",
"fileLocation": "absolute"
}, |
Any update on this? I have a c++ project which uses conan, cmake and ninja. When configured and built from a subdirectory, for example |
Fixed via #3916 |
But the fix won't be available to try until 0.28.0-insiders is released. |
This issue is fixed in 0.28.0. |
Forwarded from: microsoft/vscode#48841
Example output from file pane:
When I click on the problem, I get the following error message.
Error message:
It looks like VSCode is trying to use a relative path from
${workspaceFolder}
, even though the PROBLEMS pane is showing an absolute-ish path. Perhaps the path from the PROBLEMS pane would be appropriately identified as an absolute path if it was prefixed with a forward slash/
.The text was updated successfully, but these errors were encountered: