diff options
| author | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-03-26 01:03:54 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-26 01:03:54 -0700 |
| commit | 703d549e44d76896dee306b16b4e9e103994b4cf (patch) | |
| tree | 8f08a13e75918278568a691a7d3d7bcae8b7cc76 /lua | |
| parent | [docgen] Update CONFIG.md (diff) | |
| parent | Use the file path as root_dir when cmake does not find root_dir (diff) | |
| download | nvim-lspconfig-703d549e44d76896dee306b16b4e9e103994b4cf.tar nvim-lspconfig-703d549e44d76896dee306b16b4e9e103994b4cf.tar.gz nvim-lspconfig-703d549e44d76896dee306b16b4e9e103994b4cf.tar.bz2 nvim-lspconfig-703d549e44d76896dee306b16b4e9e103994b4cf.tar.lz nvim-lspconfig-703d549e44d76896dee306b16b4e9e103994b4cf.tar.xz nvim-lspconfig-703d549e44d76896dee306b16b4e9e103994b4cf.tar.zst nvim-lspconfig-703d549e44d76896dee306b16b4e9e103994b4cf.zip | |
Merge pull request #797 from LuoZhongYao/master
Use the file path as root_dir when cmake does not find root_dir
Diffstat (limited to 'lua')
| -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]]; }; }; }; |
