Skip to content

Commit

Permalink
fix(zls): use workspace zls.json if available
Browse files Browse the repository at this point in the history
Language server config is read from `zls.json`. By default common global
and user config directories are searched. However, this omits
per-project configuration, which can be available in the workspace dir.

We already look for `zls.json` to determine root dir, but we don't use
it when starting the language server.

This change appends `cmd` with `--config-path "zls.json"`, which uses
the file when it's available and fall-backs to default logic when file
is not available.
  • Loading branch information
lawrence-laz committed Dec 20, 2023
1 parent a2e84dd commit 9bd03c9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lua/lspconfig/server_configurations/zls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local util = require 'lspconfig.util'

return {
default_config = {
cmd = { 'zls' },
cmd = { 'zls', '--config-path', '"zls.json"' },
filetypes = { 'zig', 'zir' },
root_dir = util.root_pattern('zls.json', 'build.zig', '.git'),
single_file_support = true,
Expand All @@ -14,6 +14,7 @@ https://github.com/zigtools/zls
Zig LSP implementation + Zig Language Server
]],
default_config = {
cmd = { 'zls', '--config-path', '"zls.json"' },
root_dir = [[util.root_pattern("zls.json", "build.zig", ".git")]],
},
},
Expand Down

0 comments on commit 9bd03c9

Please sign in to comment.