aboutsummaryrefslogtreecommitdiffstats
path: root/lua/lspconfig
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2025-04-29 14:30:38 -0700
committerGitHub <noreply@github.com>2025-04-29 14:30:38 -0700
commit022ddc8fe9b822b6962ee658e91a584599604035 (patch)
tree4005c63b6c383af7402fe8c6dd3a1eac0d874cad /lua/lspconfig
parentdocs: update configs.md (diff)
downloadnvim-lspconfig-022ddc8fe9b822b6962ee658e91a584599604035.tar
nvim-lspconfig-022ddc8fe9b822b6962ee658e91a584599604035.tar.gz
nvim-lspconfig-022ddc8fe9b822b6962ee658e91a584599604035.tar.bz2
nvim-lspconfig-022ddc8fe9b822b6962ee658e91a584599604035.tar.lz
nvim-lspconfig-022ddc8fe9b822b6962ee658e91a584599604035.tar.xz
nvim-lspconfig-022ddc8fe9b822b6962ee658e91a584599604035.tar.zst
nvim-lspconfig-022ddc8fe9b822b6962ee658e91a584599604035.zip
Revert "fix(configs): remove sanitize_cmd #3806
This reverts commit 8bb2facd6fa664fe200d2d491f9f7734202426fd.
Diffstat (limited to 'lua/lspconfig')
-rw-r--r--lua/lspconfig/configs.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/lua/lspconfig/configs.lua b/lua/lspconfig/configs.lua
index 3b9967c1..b32b8001 100644
--- a/lua/lspconfig/configs.lua
+++ b/lua/lspconfig/configs.lua
@@ -24,6 +24,17 @@ local configs = {}
--- @field root_dir? string|fun(filename: string, bufnr: number)
--- @field commands? table<string, lspconfig.Config.command>
+--- @param cmd any
+local function sanitize_cmd(cmd)
+ if cmd and type(cmd) == 'table' and not vim.tbl_isempty(cmd) then
+ local original = cmd[1]
+ cmd[1] = vim.fn.exepath(cmd[1])
+ if #cmd[1] == 0 then
+ cmd[1] = original
+ end
+ end
+end
+
---@param t table
---@param config_name string
---@param config_def table Config definition read from `lspconfig.configs.<name>`.
@@ -53,6 +64,8 @@ function configs.__newindex(t, config_name, config_def)
local config = tbl_deep_extend('keep', user_config, default_config)
+ sanitize_cmd(config.cmd)
+
if util.on_setup then
pcall(util.on_setup, config, user_config)
end