Skip to content

feat: supports copy compile commands and specify target directory#316

Merged
Civitasv merged 1 commit intoCivitasv:masterfrom
Elivicti:feature-configurable-compile_commands-action
May 14, 2025
Merged

feat: supports copy compile commands and specify target directory#316
Civitasv merged 1 commit intoCivitasv:masterfrom
Elivicti:feature-configurable-compile_commands-action

Conversation

@Elivicti
Copy link
Copy Markdown
Contributor

Replaced cmake_soft_link_compile_commands and cmake_compile_commands_from_lsp with cmake_compile_commands_options, where you can specify action and target path:

cmake_compile_commands_options = {
  action = "soft_link", -- available options: soft_link, copy, lsp, none
                        -- soft_link: this will automatically make a soft link from compile commands file to target
                        -- copy:      this will automatically copy compile commands file to target
                        -- lsp:       this will automatically set compile commands file location using lsp
                        -- none:      this will make this option ignored
  target = vim.loop.cwd() -- path to directory, this is used only if action == "soft_link" or action == "copy"
},

With action = "soft_link", the behavior is the same as

cmake_soft_link_compile_commands = true

With action = "lsp", the behavior is the same as

cmake_soft_link_compile_commands = false,
cmake_compile_commands_from_lsp = true

With action = "none", the behavior is the same as

cmake_soft_link_compile_commands = false,
cmake_compile_commands_from_lsp = false

Default behavior remains unchanged. The copy action is my personal preference, and is also requested by #243 .

target is path to directory where the created symlink file or copied compile_commands.json is stored. Previously it is hardcoded to vim.loop.cwd(), now it's configurable.

I'm really bad at naming things, so if you don't like the naming or any other thing, feel free to give suggestions or just close PR.

@Civitasv
Copy link
Copy Markdown
Owner

Thanks for your contribution! This is a nice feature.

@Civitasv Civitasv merged commit 4912b0a into Civitasv:master May 14, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants