aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-09-08 08:10:59 +0200
committerGitHub <noreply@github.com>2022-09-08 14:10:59 +0800
commit932164a3cc87eafdd20c7d271037bea913b31c7b (patch)
tree19a9ad09cc86fdf66744161ce07730ce0a9a7769 /lua
parentfix(lua-language-server): check if root dir is home directory (#2110) (diff)
downloadnvim-lspconfig-932164a3cc87eafdd20c7d271037bea913b31c7b.tar
nvim-lspconfig-932164a3cc87eafdd20c7d271037bea913b31c7b.tar.gz
nvim-lspconfig-932164a3cc87eafdd20c7d271037bea913b31c7b.tar.bz2
nvim-lspconfig-932164a3cc87eafdd20c7d271037bea913b31c7b.tar.lz
nvim-lspconfig-932164a3cc87eafdd20c7d271037bea913b31c7b.tar.xz
nvim-lspconfig-932164a3cc87eafdd20c7d271037bea913b31c7b.tar.zst
nvim-lspconfig-932164a3cc87eafdd20c7d271037bea913b31c7b.zip
feat: pass user config to the on_setup hook (#2114)
This is to allow 3rd party plugins to discern between what is lspconfig's vendored server config and what the user provided. Currently, these are merged into a single table which is passed to the on_setup hook. Passing user_config as a 2nd argument would allow 3rd party plugins to apply a more sensible precedence of configs.
Diffstat (limited to 'lua')
-rw-r--r--lua/lspconfig/configs.lua22
1 files changed, 11 insertions, 11 deletions
diff --git a/lua/lspconfig/configs.lua b/lua/lspconfig/configs.lua
index a0129776..b963e424 100644
--- a/lua/lspconfig/configs.lua
+++ b/lua/lspconfig/configs.lua
@@ -30,19 +30,19 @@ function configs.__newindex(t, config_name, config_def)
-- Force this part.
default_config.name = config_name
- function M.setup(config)
+ function M.setup(user_config)
local lsp_group = vim.api.nvim_create_augroup('lspconfig', { clear = false })
validate {
- cmd = { config.cmd, 't', true },
- root_dir = { config.root_dir, 'f', true },
- filetypes = { config.filetype, 't', true },
- on_new_config = { config.on_new_config, 'f', true },
- on_attach = { config.on_attach, 'f', true },
- commands = { config.commands, 't', true },
+ cmd = { user_config.cmd, 't', true },
+ root_dir = { user_config.root_dir, 'f', true },
+ filetypes = { user_config.filetype, 't', true },
+ on_new_config = { user_config.on_new_config, 'f', true },
+ on_attach = { user_config.on_attach, 'f', true },
+ commands = { user_config.commands, 't', true },
}
- if config.commands then
- for k, v in pairs(config.commands) do
+ if user_config.commands then
+ for k, v in pairs(user_config.commands) do
validate {
['command.name'] = { k, 's' },
['command.fn'] = { v[1], 'f' },
@@ -50,10 +50,10 @@ function configs.__newindex(t, config_name, config_def)
end
end
- config = tbl_deep_extend('keep', config, default_config)
+ local config = tbl_deep_extend('keep', user_config, default_config)
if util.on_setup then
- pcall(util.on_setup, config)
+ pcall(util.on_setup, config, user_config)
end
if config.autostart == true then