aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp.lua
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2024-10-24 11:19:38 +0100
committerGitHub <noreply@github.com>2024-10-24 11:19:38 +0100
commit5c44c0240535272064bd4bb11364cb3a64d9b2cb (patch)
tree7e8f780565d187f0da993b13a470a5f423ff87db /runtime/lua/vim/lsp.lua
parent008782208d826a03ab046bb2cb1bdda27c6554d0 (diff)
parent2dcbfe78fcec5f73ce061bb24b718187b9c6b134 (diff)
downloadrneovim-5c44c0240535272064bd4bb11364cb3a64d9b2cb.tar.gz
rneovim-5c44c0240535272064bd4bb11364cb3a64d9b2cb.tar.bz2
rneovim-5c44c0240535272064bd4bb11364cb3a64d9b2cb.zip
Merge pull request #30929 from lewis6991/fix/lsp_param_encodings
Diffstat (limited to 'runtime/lua/vim/lsp.lua')
-rw-r--r--runtime/lua/vim/lsp.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index 76658b7012..4f13ad5721 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -854,7 +854,7 @@ api.nvim_create_autocmd('VimLeavePre', {
---
---@param bufnr (integer) Buffer handle, or 0 for current.
---@param method (string) LSP method name
----@param params table|nil Parameters to send to the server
+---@param params? table|(fun(client: vim.lsp.Client, bufnr: integer): table?) Parameters to send to the server
---@param handler? lsp.Handler See |lsp-handler|
--- If nil, follows resolution strategy defined in |lsp-handler-configuration|
---@param on_unsupported? fun()
@@ -879,7 +879,8 @@ function lsp.buf_request(bufnr, method, params, handler, on_unsupported)
if client.supports_method(method, { bufnr = bufnr }) then
method_supported = true
- local request_success, request_id = client.request(method, params, handler, bufnr)
+ local cparams = type(params) == 'function' and params(client, bufnr) or params --[[@as table?]]
+ local request_success, request_id = client.request(method, cparams, handler, bufnr)
-- This could only fail if the client shut down in the time since we looked
-- it up and we did the request, which should be rare.
if request_success then