mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-24 17:58:51 +02:00
feat(clangd): better clangd root detection (#1165)
This commit is contained in:
parent
a184fc1c73
commit
d71ebeab24
1 changed files with 11 additions and 6 deletions
|
@ -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" },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue