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
Default include path relative to .code-workspace file #2009
Is there to any way to set default include paths relative to the .code-workspace file? I am trying to use the "C_Cpp.default.includePath" propery to set common include paths for all the folders in my multi-root workspace, but some of the folders are at different depths so using "${workspaceFolder}/../../lib1" isn't resolving properly in only some of the folders.
VS Code also has a syntax for ${workspaceFolder:<folder_name>} that we don't support yet. Once we support it I think that would resolve this issue. See #1774. If you think that will work for you, let us know and we'll close this issue as a duplicate.
In my specific situation the ${workspaceFolder:<folder_name>} syntax would work. Basically I am trying set every folder included in my workspace as a default include path. Unless vscode created another environment variable for the multiroot workspace path, I think this is my best option.
Sean McManus (@sean-mcmanus) the .code-workspace usually lives in one of the folders. ${workspaceFolder:<folder_name>} is constant, so it should be a sufficient anchor for a relative path.
Activity
sean-mcmanus commentedon May 18, 2018
Can you use something like the following?
prsullivan commentedon May 18, 2018
Is "env" available in for use in the workspace settings? I thought that could only be used in c_cpp_properties.json folder settings.
sean-mcmanus commentedon May 18, 2018
Oops, yeah, you're right. Can you use a hardcoded path to the workspace's folder?
prsullivan commentedon May 18, 2018
I could, but I would prefer not to.
sean-mcmanus commentedon May 18, 2018
We support ${env:var} (uses environment variables) and ${config:var} (uses other settings.json), see https://code.visualstudio.com/docs/editor/variables-reference . I don't know of a VS Code defined variable that references the folder with .code-workspace file...it doesn't seem like we should add our own variable to support referencing that until VS Code adds such a variable.
bobbrow commentedon May 22, 2018
VS Code also has a syntax for
${workspaceFolder:<folder_name>}that we don't support yet. Once we support it I think that would resolve this issue. See #1774. If you think that will work for you, let us know and we'll close this issue as a duplicate.sean-mcmanus commentedon May 22, 2018
Bob Brown (@bobbrow) I don't think that would be sufficient. A particular workspace folder is different from the workspace "root".
prsullivan commentedon May 22, 2018
In my specific situation the ${workspaceFolder:<folder_name>} syntax would work. Basically I am trying set every folder included in my workspace as a default include path. Unless vscode created another environment variable for the multiroot workspace path, I think this is my best option.
bobbrow commentedon May 22, 2018
Sean McManus (@sean-mcmanus) the .code-workspace usually lives in one of the folders.
${workspaceFolder:<folder_name>}is constant, so it should be a sufficient anchor for a relative path.bobbrow commentedon May 22, 2018
Closing as duplicate of #1774
bobbrow commentedon May 22, 2018
I opened a pull request for this.
sean-mcmanus commentedon May 22, 2018
prsullivan 0.17.3 supports ${workspaceFolder:folderName}.
prsullivan commentedon May 23, 2018
Thank you!