Open emmenlau opened 3 years ago
I should have mentioned that I do know this option. But its not exactly what I had in mind. The problem with this option is that we have literally hundreds of projects, and typically have many of them open at the same time. We will need a tree of directories where to copy all the temporary compile_commands.json
files. Or we will need to copy the compile_commands.json
to the source folder, which in turn pollutes the source tree. All of this is of course possible if no other options are available. But much much nicer would be if there was a way to dynamically resolve compile_commands.json
for the currently active build configuration...
See https://github.com/clangd/clangd/issues/526 for a similar request. At least the workaround described there (to change clangd.arguments
to pass a different --compile-commands-dir=<path>
) should be viable now.
Clangd has also since introduced the ability to control the location of compile_commands.json
via its config file (see the CompilationDatabase
key), so another possibility could be modifying the value in the config file.
We use cmake tools to build from VSCode. It places
compile_commands.json
in specific folders, with eitherDebug
orRelease
in the path. It would be great if the two extensions could work together to resolve the path, is that possible?I'm not sure what either of the two extensions would need to do to make that work. I guess vscode-clangd would need an environment variable that resolves to
Debug
orRelease
? And when switching the build target in cmake tools, vscode-clangd would need to get some notification that the path changed?