vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

Infer compile_commands.json entries for new files

Open ryanpholt opened this issue 6 years ago • 2 comments

I've configured Intellisense using a compile_commands.json file. So, whenever I create a new file in my workspace, Intellisense shows a warning saying that there is no entry in the compile_commands.json for the new file (and no Intellisense operations work). Can the extension infer the build args from a different translation unit in the same folder/workspace? My experience with ccls/clangd in the past is that they do something like this. Maybe the extension could emit a warning saying that it inferred the build arguments for the file that it could not find in compile_commands.json?

My current workflow involves regenerating the compile_commands whenever I add a new file but that is less than ideal. I suppose I could fill in the includePath, defines, etc. just for the case when I add new files. But, our build system is complicated and so it is much easier to rely on compile_commands.json.

ryanpholt avatar Aug 07 '20 20:08 ryanpholt

Hi @ryan-holt-1 . Thanks for the suggestion. In the meanwhile, you should be able to provide fallback settings in the same configuration in c_cpp_properties.json. Normally, use of compileCommands would supersede any other configuration settings. But, when an entry is not available in compile_commands.json, the extension should fall back the rest of that configuration in c_cpp_properties.json (or equivilent C_Cpp.default.* settings). Please let us know if that doesn't work as expected for you.

Colengms avatar Aug 07 '20 23:08 Colengms

This feature request is being closed due to insufficient upvotes. When enough upvotes are received, this issue will be eligible for our backlog.

github-actions[bot] avatar Jun 14 '21 11:06 github-actions[bot]