aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorLuoZhongYao <LuoZhongYao@gmail.com>2021-03-26 15:14:20 +0800
committerLuoZhongYao <LuoZhongYao@gmail.com>2021-03-26 15:59:45 +0800
commitb49f4c3717422b7fc49ac622e179e23458c55805 (patch)
tree8f08a13e75918278568a691a7d3d7bcae8b7cc76 /lua
parent[docgen] Update CONFIG.md (diff)
downloadnvim-lspconfig-b49f4c3717422b7fc49ac622e179e23458c55805.tar
nvim-lspconfig-b49f4c3717422b7fc49ac622e179e23458c55805.tar.gz
nvim-lspconfig-b49f4c3717422b7fc49ac622e179e23458c55805.tar.bz2
nvim-lspconfig-b49f4c3717422b7fc49ac622e179e23458c55805.tar.lz
nvim-lspconfig-b49f4c3717422b7fc49ac622e179e23458c55805.tar.xz
nvim-lspconfig-b49f4c3717422b7fc49ac622e179e23458c55805.tar.zst
nvim-lspconfig-b49f4c3717422b7fc49ac622e179e23458c55805.zip
Use the file path as root_dir when cmake does not find root_dir
Diffstat (limited to 'lua')
-rw-r--r--lua/lspconfig/cmake.lua6
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]];
};
};
};