diff options
| author | William Boman <william@redwill.se> | 2022-09-08 08:10:59 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-08 14:10:59 +0800 |
| commit | 932164a3cc87eafdd20c7d271037bea913b31c7b (patch) | |
| tree | 19a9ad09cc86fdf66744161ce07730ce0a9a7769 /test | |
| parent | fix(lua-language-server): check if root dir is home directory (#2110) (diff) | |
| download | nvim-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 'test')
| -rw-r--r-- | test/lspconfig_spec.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/lspconfig_spec.lua b/test/lspconfig_spec.lua index f98568c1..8cea4a54 100644 --- a/test/lspconfig_spec.lua +++ b/test/lspconfig_spec.lua @@ -324,5 +324,23 @@ describe('lspconfig', function() { 'rust_analyzer' } ) end) + + it('provides user_config to the on_setup hook', function() + eq( + exec_lua [[ + local lspconfig = require "lspconfig" + local util = require "lspconfig.util" + local user_config + util.on_setup = function (_, _user_config) + user_config = _user_config + end + lspconfig.rust_analyzer.setup { custom_user_config = "custom" } + return user_config + ]], + { + custom_user_config = 'custom', + } + ) + end) end) end) |
