fix(lspconfig): add hook before and not after (#92)

## Description
A common use of `on_new_config` is to construct the `cmd` for starting
language servers based on the configuration. These language servers
require that the settings are finalized before it is run. It looks like
previous commits did use `add_hook_before` for the `lspconfig`
integration but it got moved to being `add_hook_after` when centralizing
it with the `lua_ls` and `jsonls` plugin integrations. We should revert
this back to `add_hook_before` so that the existing `on_new_config`
functions continue working.
This commit is contained in:
Micah Halter 2025-02-27 02:53:52 -05:00 committed by GitHub
parent 87f703a298
commit 5cff548d38
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -39,7 +39,7 @@ end
---@param opts { on_config: fun(config, root_dir:string, original_config), root_dir: fun(), name: string } ---@param opts { on_config: fun(config, root_dir:string, original_config), root_dir: fun(), name: string }
function M.on_config(opts) function M.on_config(opts)
local lsputil = require("lspconfig.util") local lsputil = require("lspconfig.util")
local hook = lsputil.add_hook_after local hook = lsputil.add_hook_before
lsputil.on_setup = hook(lsputil.on_setup, function(initial_config) lsputil.on_setup = hook(lsputil.on_setup, function(initial_config)
if opts.on_config then if opts.on_config then