Vscode-cmake-tools: Add header search paths to c_cpp_properties.json

Created on 24 Aug 2016  路  14Comments  路  Source: microsoft/vscode-cmake-tools

Currently we need to manually add the search paths to c_cpp_properties.json but it would be nice if this could be done automatically based on what cmake discovers during configure.

Feature Request in progress

Most helpful comment

I strongly wish to have greater support for tools to automatically consume information from the build system. For example, I work on many projects at both work and home that have drastically variable include paths and compiler options/definitions. It would be great to have my tools automatically pick up the appropriate flags.

This is possible for me to implement; however: I have an open pull request open with vscode-clang, and there is an open issue with vscode-cpptools, both of which are related to consuming the compile_commands.json file generated by build tools (including CMake). I'd rather that these tools be able to recognize the compile_commands.json file format themselves.

Unfortunately, vscode-clang seems to have stagnated since late April, with no updates or communication from the maintainer. Being one of the most popular extensions, I'm quite disappointed and greatly wish that we could get some information.

As for vscode-cpptools, the issue has been open for a while, but without much feedback from Microsoft. I'd recommend voting on the related issues/PRs to see if we can get some upstream support for compile_commands.json, which would be generally more reliable/useful that anything I could even do within my own extension.

All 14 comments

I strongly wish to have greater support for tools to automatically consume information from the build system. For example, I work on many projects at both work and home that have drastically variable include paths and compiler options/definitions. It would be great to have my tools automatically pick up the appropriate flags.

This is possible for me to implement; however: I have an open pull request open with vscode-clang, and there is an open issue with vscode-cpptools, both of which are related to consuming the compile_commands.json file generated by build tools (including CMake). I'd rather that these tools be able to recognize the compile_commands.json file format themselves.

Unfortunately, vscode-clang seems to have stagnated since late April, with no updates or communication from the maintainer. Being one of the most popular extensions, I'm quite disappointed and greatly wish that we could get some information.

As for vscode-cpptools, the issue has been open for a while, but without much feedback from Microsoft. I'd recommend voting on the related issues/PRs to see if we can get some upstream support for compile_commands.json, which would be generally more reliable/useful that anything I could even do within my own extension.

@vector-of-bool that plugin should be built using language server feature and not as a plain plugin. You'll see completions lagging with a large code.

Ping for this.

There is a thread on the MS C/C++ extension issues list on how to notify the C/C++ extension of header files and how the IntelliSense engine pick up modification automatically. See here.

Allow me to ping this topic with the addition that it is not just the c_cpp_properties.json file that could be updated based on cmake server mode output, but also the C/C++ executable targets could be added to the launch.json file. This is virtually the last thing needed for VS Code to be a fully functional C++ IDE. (And #117)

@MathiasMagnus, you should be able to use a ${command:cmake.debugTargetProgramPath} substitution within launch.json.

(Unfortunately, there's still quite a few things I haven't documented in full, although all features are at least touched on in the changelog when they were added)

We have committed to support reading from the compile_commands.json file in the Microsoft C/C++ extension. Would adding a property to the c_cpp_properties.json file where you can direct the extension to find your compile_commands.json file be sufficient to resolve this issue? Or would it more align with your expectations to add a new workspace setting in settings.json where you could tell us where the file is? Do you ever expect to have more than one compile_commands.json file per workspace?

@vector-of-bool did you see @bobbrow's comment?

@a-teammate, yes. The cpptools extension added support for compilation databases a while ago, although not in full. Development is ongoing on both sides. If compilation database support reaches a certain threshold of support, having CMake Tools manipulate c_cpp_properties.json will be unnecessary.

ping

@loaden, MS has been working on compilation database support and even recently released a few more bugfixes/improvements. What are you "ping"-ing about in particular?

It's been a _long time_. But I have good news. Keep an eye out for 1.1.0.

good

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andschwa picture andschwa  路  6Comments

gabyx picture gabyx  路  5Comments

bobbrow picture bobbrow  路  4Comments

retifrav picture retifrav  路  5Comments

amigo421 picture amigo421  路  3Comments