feat(clangd): better clangd root detection (#1165)
This commit is contained in:
@ -53,14 +53,19 @@ return {
|
|||||||
keys = {
|
keys = {
|
||||||
{ "<leader>cR", "<cmd>ClangdSwitchSourceHeader<cr>", desc = "Switch Source/Header (C/C++)" },
|
{ "<leader>cR", "<cmd>ClangdSwitchSourceHeader<cr>", desc = "Switch Source/Header (C/C++)" },
|
||||||
},
|
},
|
||||||
root_dir = function(...)
|
root_dir = function(fname)
|
||||||
-- using a root .clang-format or .clang-tidy file messes up projects, so remove them
|
|
||||||
return require("lspconfig.util").root_pattern(
|
return require("lspconfig.util").root_pattern(
|
||||||
"compile_commands.json",
|
"Makefile",
|
||||||
"compile_flags.txt",
|
"CMakeLists.txt",
|
||||||
"configure.ac",
|
"configure.ac",
|
||||||
".git"
|
"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(fname)
|
||||||
end,
|
end,
|
||||||
capabilities = {
|
capabilities = {
|
||||||
offsetEncoding = { "utf-16" },
|
offsetEncoding = { "utf-16" },
|
||||||
|
Reference in New Issue
Block a user