From 932164a3cc87eafdd20c7d271037bea913b31c7b Mon Sep 17 00:00:00 2001 From: William Boman Date: Thu, 8 Sep 2022 08:10:59 +0200 Subject: 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. --- test/lspconfig_spec.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test') 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) -- cgit v1.2.3-70-g09d2