keys = {
{ "<leader>ch", "<cmd>ClangdSwitchSourceHeader<cr>", desc = "Switch Source/Header (C/C++)" },
},
- root_dir = function(fname)
- return require("lspconfig.util").root_pattern( "compile_commands.json", "compile_flags.txt")(fname)
- or 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").find_git_ancestor(fname)
- end,
+ root_markers = {
+ -- clangd
+ { "compile_commands.json", "compile_flags.txt", ".clangd"},
+ -- build tools
+ {
+ "Makefile",
+ "configure.ac",
+ "configure.in",
+ "config.h.in",
+ "meson.build",
+ "meson_options.txt",
+ "build.ninja"
+ },
+ -- git fallback
+ { ".git" },
+ },
capabilities = {
offsetEncoding = { "utf-16" },
},