clangd
clangd copied to clipboard
support different names for compiled_commands.json
For ExternalProject-based CMake superbuild, one might have a lot of compile_commands.json
files placed in different directories, which might not respect the project set up of clangd.
In VScode one could use CMakeTools
extension to merge all these compile_commands.json
files into a unique one by setting the following option:
"cmake.mergedCompileCommands": "${workspaceFolder}/build/merged_compile_commands.json"
In this case for example, the merged file is called merged_compile_commands.json
to distinguish it from the other compile_commands.json
files.
Though, this new file is not found by clangd
when setting the following option:
"clangd.arguments": [
"--compile-commands-dir=${workspaceFolder}/build/"
],
It would be helpful to have an option like --compile-commands-file
that one could set as follows:
"clangd.arguments": [
"--compile-commands-file=${workspaceFolder}/build/merged_compile_commands.json"
],
I noticed your use of ${workspaceFolder}
in the clangd.arguments
. Does that currently work for you (minus the "merged" part)?
I ask because using named workspaces in there does not. (eg. replace yours with ${workspaceFolder:<name>}/<...>
I noticed your use of
${workspaceFolder}
in theclangd.arguments
. Does that currently work for you (minus the "merged" part)? I ask because using named workspaces in there does not. (eg. replace yours with${workspaceFolder:<name>}/<...>
${workspaceFolder}
works because its substitution has been manually implemented in vscode-clangd.
There is no comparable implementation of ${workspaceFolder:<name>}
, though I imagine a patch to add that would be welcome. (Even better would be to call into some sort of VSCode API to automatically handle all the variable substitutions that VSCode itself handles, if such a thing exists.)