backport: feat(lsp): pass resolved config to cmd() #34560

Problem:
In LSP configs, the function form of `cmd()` cannot easily get the
resolved root dir (workspace). One of the main use-cases of a dynamic
`cmd()` is to be able to start a new server  whose binary may be located
*in the workspace* ([example](https://github.com/neovim/nvim-lspconfig/pull/3912)).

Compare `reuse_client()`, which also receives the resolved config.

Solution:
Pass the resolved config to `cmd()`.


(cherry picked from commit 32f30c4874)

Co-authored-by: Julian Visser <12615757+justmejulian@users.noreply.github.com>
This commit is contained in:
Justin M. Keyes
2025-06-18 05:46:53 -07:00
committed by GitHub
parent 6396bfb29f
commit ecf5164d2d
5 changed files with 24 additions and 15 deletions

View File

@@ -54,7 +54,7 @@ M.create_server_definition = function()
local server = {}
server.messages = {}
function server.cmd(dispatchers)
function server.cmd(dispatchers, _config)
local closing = false
local handlers = opts.handlers or {}
local srv = {}