aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/lsp.txt6
-rw-r--r--runtime/lua/vim/lsp.lua2
-rw-r--r--test/functional/plugin/lsp_spec.lua4
3 files changed, 11 insertions, 1 deletions
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index 48d65a22b6..c434f6db66 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -224,6 +224,11 @@ For |lsp-request|, each |lsp-handler| has this signature: >
The ID of the |vim.lsp.client|.
{bufnr} (Buffer)
Buffer handle, or 0 for current.
+
+ {params} (table|nil)
+ The parameters used in the original request
+ which resulted in this handler
+ call.
{config} (table)
Configuration for the handler.
@@ -234,6 +239,7 @@ For |lsp-request|, each |lsp-handler| has this signature: >
To configure a particular |lsp-handler|, see:
|lsp-handler-configuration|
+
Returns: ~
The |lsp-handler| can respond by returning two values: `result, err`
Where `err` must be shaped like an RPC error:
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index 90c5872f11..17ba4939bd 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -896,7 +896,7 @@ function lsp.start_client(config)
local _ = log.debug() and log.debug(log_prefix, "client.request", client_id, method, params, handler, bufnr)
return rpc.request(method, params, function(err, result)
- handler(err, result, {method=method, client_id=client_id, bufnr=bufnr})
+ handler(err, result, {method=method, client_id=client_id, bufnr=bufnr, params=params})
end)
end
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua
index 6ad37110c7..7319a02533 100644
--- a/test/functional/plugin/lsp_spec.lua
+++ b/test/functional/plugin/lsp_spec.lua
@@ -2353,6 +2353,10 @@ describe('LSP', function()
eq(0, signal, "exit signal", fake_lsp_logfile)
end;
on_handler = function(err, result, ctx)
+ -- Don't compare & assert params, they're not relevant for the testcase
+ -- This allows us to be lazy and avoid declaring them
+ ctx.params = nil
+
eq(table.remove(test.expected_handlers), {err, result, ctx}, "expected handler")
if ctx.method == 'start' then
exec_lua("vim.lsp.buf.rename()")