Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code includePath subdirectories

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?

like image 300
Leorekk Avatar asked Aug 04 '17 11:08

Leorekk


People also ask

How do I add all subdirectories?

The -R (uppercase R) option lists all subdirectories, recursively. That shows you the whole directory tree starting at the current directory (or the directories you name on the command line).

What is the purpose of subdirectories?

A subdirectory is a type of website hierarchy under a root domain that uses folders to organize content on a website. A subdirectory is the same as a subfolder and the names can be used interchangeably.

How do I change the compiler path in VS code?

In the Windows search bar, type 'settings' to open your Windows Settings. Search for Edit environment variables for your account. Choose the Path variable in your User variables and then select Edit. Select New and add the Mingw-w64 destination folder path to the system path.


2 Answers

I believe this is what you are looking for:

"${workspaceFolder}/**"

Assuming all the dirs are inside your working space folder.

like image 78
ENDEESA Avatar answered Oct 05 '22 21:10

ENDEESA


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 use package 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 any packages.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.

like image 24
VonC Avatar answered Oct 05 '22 22:10

VonC