aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/lspconfig/configs/zls.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/lua/lspconfig/configs/zls.lua b/lua/lspconfig/configs/zls.lua
index d92a797d..8deeda97 100644
--- a/lua/lspconfig/configs/zls.lua
+++ b/lua/lspconfig/configs/zls.lua
@@ -3,6 +3,11 @@ local util = require 'lspconfig.util'
return {
default_config = {
cmd = { 'zls' },
+ on_new_config = function(new_config, new_root_dir)
+ if vim.fn.filereadable(vim.fs.joinpath(new_root_dir, 'zls.json')) ~= 0 then
+ new_config.cmd = { 'zls', '--config-path', 'zls.json' }
+ end
+ end,
filetypes = { 'zig', 'zir' },
root_dir = util.root_pattern('zls.json', 'build.zig', '.git'),
single_file_support = true,
@@ -14,6 +19,7 @@ https://github.com/zigtools/zls
Zig LSP implementation + Zig Language Server
]],
default_config = {
+ cmd = { 'zls' },
root_dir = [[util.root_pattern("zls.json", "build.zig", ".git")]],
},
},