diff options
author | James Walmsley <[email protected]> | 2021-07-03 00:44:18 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-07-02 19:44:18 -0400 |
commit | af207091bcc060027cd7389b50eda8e7b5dec586 (patch) | |
tree | ef06d6951c0b6b1ae89a4ff6f48d4e56954c5e68 /ftplugin/c.lua | |
parent | c384c1b1a220c6972ffa037a07e3630d834c8aef (diff) |
[LSP] clang - Better defaults for clangd. (#601)
Diffstat (limited to 'ftplugin/c.lua')
-rw-r--r-- | ftplugin/c.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/ftplugin/c.lua b/ftplugin/c.lua index 594c375b..8a7ef9fd 100644 --- a/ftplugin/c.lua +++ b/ftplugin/c.lua @@ -1,5 +1,13 @@ +local clangd_flags = {"--background-index"}; + +if O.lang.clang.cross_file_rename then + table.insert(clangd_flags, "--cross-file-rename") +end + +table.insert(clangd_flags, "--header-insertion=" .. O.lang.clang.header_insertion) + require'lspconfig'.clangd.setup { - cmd = {DATA_PATH .. "/lspinstall/cpp/clangd/bin/clangd"}, + cmd = {DATA_PATH .. "/lspinstall/cpp/clangd/bin/clangd", unpack(clangd_flags)}, on_attach = require'lsp'.common_on_attach, handlers = { ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { |