34 lines
818 B
Lua
34 lines
818 B
Lua
---@type vim.lsp.Config
|
|
return {
|
|
keys = {
|
|
{ "<leader>ch", "<cmd>ClangdSwitchSourceHeader<cr>", desc = "Switch Source/Header (C/C++)" },
|
|
},
|
|
root_dir = function(name)
|
|
return require("lspconfig.util").root_pattern(
|
|
"Makefile",
|
|
"configure.ac",
|
|
"configure.in",
|
|
"config.h.in",
|
|
"meson.build",
|
|
"meson_options.txt",
|
|
"build.ninja"
|
|
)(fname) or require("lspconfig.util").root_pattern("compile_commands.json", "compile_flags.txt")(fname) or require(
|
|
"lspconfig.util"
|
|
).find_git_ancestor(name)
|
|
end,
|
|
cmd = {
|
|
"clangd",
|
|
"--background-index",
|
|
"--clang-tidy",
|
|
"--header-insertion=iwyu",
|
|
"--completion-arg-placeholders",
|
|
"--function-arg-placeholders",
|
|
"--fallback-style=llvm",
|
|
},
|
|
init_options = {
|
|
usePlaceholders = true,
|
|
completeUnimported = true,
|
|
clangdFileStatus = true,
|
|
},
|
|
}
|