Vscode-cpptools: Can c_cpp_properties.json support wildcard paths?

Created on 12 May 2017  路  8Comments  路  Source: microsoft/vscode-cpptools

The scripts I am using to build my projects are generating the dependencies in a folder. It could be very useful in this situation to be able to give a path like this /my/path/*/include to simplify /my/path/dep1/include /my/path/dep2/include /my/path/dep3/include

I would be pleased to have your opinion. :)

Feature Request Language Service help wanted

Most helpful comment

In my opinion, in addition to supporting the normal "" it would be also good have "*" as the globstar in bash.

From the bash manpage:

globstar
If set, the pattern ** used in a pathname expansion context will
match all files and zero or more directories and subdirectories.
If the pattern is followed by a /, only directories and
subdirectories match.

Then, we could use, for example,

  • /my/path/**/include
  • /my/path/**/include/**/

All 8 comments

This should be implementable in our open source typescript if anyone wants to contribute :)

With 0.17.5 you should be able to use /my/path/** and it will add all of the relevant paths. Let us know if that works for you.

Hi, is a middle wildcard not supported though? For example:

/Users/aaron/Documents/github/opencv/modules/*/include/**

It's not finding the path, and I'm trying to avoid adding each opencv/modules/<some-module>/include/** to the includePath

Thanks

As far as I can see the middle wildcard doesn't work. Our include files are all "include" & "interface" directories in many places. So this only leaves using everything via "${workspaceFolder}/", or adding each one in turn when required (which may be better where there are duplicated names). I suspect using "${workspaceFolder}/" isn't great for performance.

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.

This is the branch: https://github.com/Microsoft/vscode-cpptools/tree/bobbrow/expand-wildcards

In my opinion, in addition to supporting the normal "" it would be also good have "*" as the globstar in bash.

From the bash manpage:

globstar
If set, the pattern ** used in a pathname expansion context will
match all files and zero or more directories and subdirectories.
If the pattern is followed by a /, only directories and
subdirectories match.

Then, we could use, for example,

  • /my/path/**/include
  • /my/path/**/include/**/

Hey @bobbrow,

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.

This is the branch: https://github.com/Microsoft/vscode-cpptools/tree/bobbrow/expand-wildcards

Looking into how the wildcard support is added to vscode-cpptools, I've come across a couple PRs (#1896, #2136); Their changes do not make much sense into how the recursive includePath is implemented.
Looking around for uses of IncludePath don't yield much insight apart from UI settings, json settings and verification of it includePath.

It looks like it's all passed off to pre-compiled cpptools binaries. which I can't find the source code for. Are you able to link to the repository so that I may continue investigation and figure out how to implement includePath globbing.

@NZSmartie cpptools is closed source. It seems like "*" and/or "**" in paths should be implementable in the TypeScript. The implementation is complicated and tries to filter out unneeded paths in order to reduce the performance impact on cpptools-srv, but usage of "*" and "**" in path segments isn't expected to generate the same performance hit as "**" at the end of a path.

Was this page helpful?
0 / 5 - 0 ratings