Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support different names for compiled_commands.json #1932

Open
LoreMoretti opened this issue Feb 14, 2024 · 2 comments
Open

support different names for compiled_commands.json #1932

LoreMoretti opened this issue Feb 14, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@LoreMoretti
Copy link

LoreMoretti commented Feb 14, 2024

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"
    ],
@vindicatorr
Copy link

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>}/<...>

@HighCommander4
Copy link
Contributor

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>}/<...>

${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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants