Reputation: 143
I'm struggling with the includePath setting on a bigger project source. Let's say I have a folder structure like:
/BaseComponent/public
/BaseComponent/include
/BaseComponent/source
/SubComponent1/public
/SubComponent1/include
/SubComponent1/source
/SubComponent1/SubSubComponent/public
/SubComponent1/SubSubComponent/include
/SubComponent1/SubSubComponent/source
/SubComponent2/public
/SubComponent2/include
/SubComponent2/source
I tried to do a configuration like this:
"includePath": [
...
"${workspaceRoot}",
"${workspaceRoot}/*/include",
"${workspaceRoot}/*/public"
],
But this didn't appear to work out. Is there a way to have just all header inside the workspaceRoot used? Something like "include all subfolder"?
OR another way to define a path which is project in dependend?
Upvotes: 11
Views: 11058
Reputation: 1324268
June 2023: this is supported, as detailed in "how to include all child folders with specific folder name as include path in VSCode C++".
microsoft/vscode-cpptools
PR 10388: "Add wildcard support for includeDir
" implements this.
Oct. 2018: That is not yet possible/supported, as mentioned in Microsoft/vscode-cpptools
issue 849.
Example of a context illustrating that issue:
The
includePath
doesn't seem to work with NuGet packages since the directory name includes the version.
For example, if we usepackage rapidjson 1.0.
2 and later upgrade, we'd have to update references to "packages/rapidjson.1.0.2/build/native/include
" in this file - in additional to anypackages.config
files.
It would be nice if we could use wildcards in directory specifiers or some other means of not having to maintain the same information in two different places.
So the alternative is to version a script able to generate the configuration file by updating the IncludePath
section with all include folders found.
Note: issue 849 is actually a duplicate of issue 723, which states (Bob Brown, from Microsoft):
A middle wildcard is not currently supported.
I started a branch that would support this a while ago, but I forget what state it was in and now the branch is out of date.
If anyone wants to get it back in sync with master and finish it, we can consider taking it.
I'll reopen this issue since the original request was not actually addressed.
Upvotes: 1
Reputation: 3781
I believe this is what you are looking for:
"${workspaceFolder}/**"
Assuming all the dirs are inside your working space folder.
Upvotes: 8