aboutsummaryrefslogtreecommitdiffstats
path: root/lua/lspconfig/server_configurations/zls.lua
diff options
context:
space:
mode:
authorLaurynas Lazauskas <8823448+lawrence-laz@users.noreply.github.com>2023-12-18 07:34:47 +0200
committerGitHub <noreply@github.com>2023-12-18 13:34:47 +0800
commitdbfafcac2ce9e10c9f4419299d413580996ae155 (patch)
tree7ea2b49ad674468e04fb0676b5d9ccaebb7d8ce6 /lua/lspconfig/server_configurations/zls.lua
parentdocs: update server_configurations.md (diff)
downloadnvim-lspconfig-dbfafcac2ce9e10c9f4419299d413580996ae155.tar
nvim-lspconfig-dbfafcac2ce9e10c9f4419299d413580996ae155.tar.gz
nvim-lspconfig-dbfafcac2ce9e10c9f4419299d413580996ae155.tar.bz2
nvim-lspconfig-dbfafcac2ce9e10c9f4419299d413580996ae155.tar.lz
nvim-lspconfig-dbfafcac2ce9e10c9f4419299d413580996ae155.tar.xz
nvim-lspconfig-dbfafcac2ce9e10c9f4419299d413580996ae155.tar.zst
nvim-lspconfig-dbfafcac2ce9e10c9f4419299d413580996ae155.zip
fix(zls): include `build.zig` in root dir search (#2933)
File `build.zig` by convention sits at the root dir and thus can be used to correctly identify the root directory. This is particularly useful if `zls` has `enable_build_on_save` set to `true`, since then the language server uses workspace path (root_dir) to execute `zig build` command, output of which is then used to publish diagnostic errors. Without `build.zig` root directory can incorrectly be deduced some layers too high at the root of the git repo. In such case `enable_build_on_save` silently fails and does not report build error diagnostics.
Diffstat (limited to 'lua/lspconfig/server_configurations/zls.lua')
-rw-r--r--lua/lspconfig/server_configurations/zls.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/lua/lspconfig/server_configurations/zls.lua b/lua/lspconfig/server_configurations/zls.lua
index d890fb63..d92a797d 100644
--- a/lua/lspconfig/server_configurations/zls.lua
+++ b/lua/lspconfig/server_configurations/zls.lua
@@ -4,7 +4,7 @@ return {
default_config = {
cmd = { 'zls' },
filetypes = { 'zig', 'zir' },
- root_dir = util.root_pattern('zls.json', '.git'),
+ root_dir = util.root_pattern('zls.json', 'build.zig', '.git'),
single_file_support = true,
},
docs = {
@@ -14,7 +14,7 @@ https://github.com/zigtools/zls
Zig LSP implementation + Zig Language Server
]],
default_config = {
- root_dir = [[util.root_pattern("zls.json", ".git")]],
+ root_dir = [[util.root_pattern("zls.json", "build.zig", ".git")]],
},
},
}