diff options
| -rw-r--r-- | lua/lspconfig/cmake.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lua/lspconfig/cmake.lua b/lua/lspconfig/cmake.lua index 9dbcf717..42e83329 100644 --- a/lua/lspconfig/cmake.lua +++ b/lua/lspconfig/cmake.lua @@ -5,7 +5,9 @@ configs.cmake = { default_config = { cmd = {"cmake-language-server"}; filetypes = {"cmake"}; - root_dir = util.root_pattern(".git", "compile_commands.json", "build"); + root_dir = function(fname) + return util.root_pattern(".git", "compile_commands.json", "build")(fname) or util.path.dirname(fname) + end; init_options = { buildDirectory = "build", } @@ -17,7 +19,7 @@ https://github.com/regen100/cmake-language-server CMake LSP Implementation ]]; default_config = { - root_dir = [[root_pattern(".git", "compile_commands.json", "build")]]; + root_dir = [[root_pattern(".git", "compile_commands.json", "build") or dirname]]; }; }; }; |
