aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc
diff options
context:
space:
mode:
authorMichael Lingelbach <m.j.lbach@gmail.com>2021-09-05 10:27:52 -0700
committerJustin M. Keyes <justinkz@gmail.com>2021-09-26 10:25:17 -0700
commitcd8f6c5fb7858d8981fdfb2067bddb3eb86c13d0 (patch)
tree980dbf25f4342e9cf4b616f6c242df3355963ec8 /runtime/doc
parentf8e0011534a3f94cfd341fd9bfce1bcf9b1b7b73 (diff)
downloadrneovim-cd8f6c5fb7858d8981fdfb2067bddb3eb86c13d0.tar.gz
rneovim-cd8f6c5fb7858d8981fdfb2067bddb3eb86c13d0.tar.bz2
rneovim-cd8f6c5fb7858d8981fdfb2067bddb3eb86c13d0.zip
feat(lsp)!: change handler signature #15504
Diffstat (limited to 'runtime/doc')
-rw-r--r--runtime/doc/lsp.txt64
-rw-r--r--runtime/doc/lua.txt14
-rw-r--r--runtime/doc/treesitter.txt8
3 files changed, 49 insertions, 37 deletions
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index d6ef761bcb..73e4cbe2ca 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -202,23 +202,28 @@ responses and notifications from LSP servers.
For |lsp-request|, each |lsp-handler| has this signature: >
- function(err, method, result, client_id, bufnr, config)
+ function(err, result, ctx, config)
<
Parameters: ~
{err} (table|nil)
When the language server is unable to complete a
request, a table with information about the error
is sent. Otherwise, it is `nil`. See |lsp-response|.
- {method} (string)
- The |lsp-method| name.
{result} (Result | Params | nil)
When the language server is able to succesfully
complete a request, this contains the `result` key
of the response. See |lsp-response|.
- {client_id} (number)
- The ID of the |vim.lsp.client|.
- {bufnr} (Buffer)
- Buffer handle, or 0 for current.
+ {ctx} (table)
+ Context describes additional calling state
+ associated with the handler. It consists of the
+ following key, value pairs:
+
+ {method} (string)
+ The |lsp-method| name.
+ {client_id} (number)
+ The ID of the |vim.lsp.client|.
+ {bufnr} (Buffer)
+ Buffer handle, or 0 for current.
{config} (table)
Configuration for the handler.
@@ -238,21 +243,24 @@ For |lsp-request|, each |lsp-handler| has this signature: >
For |lsp-notification|, each |lsp-handler| has this signature: >
- function(err, method, params, client_id, bufnr, config)
+ function(err, result, ctx, config)
<
Parameters: ~
{err} (nil)
This is always `nil`.
See |lsp-notification|
- {method} (string)
- The |lsp-method| name.
- {params} (Params)
+ {result} (Result)
This contains the `params` key of the notification.
See |lsp-notification|
- {client_id} (number)
- The ID of the |vim.lsp.client|
- {bufnr} (nil)
- `nil`, as the server doesn't have an associated buffer.
+ {ctx} (table)
+ Context describes additional calling state
+ associated with the handler. It consists of the
+ following key, value pairs:
+
+ {method} (string)
+ The |lsp-method| name.
+ {client_id} (number)
+ The ID of the |vim.lsp.client|.
{config} (table)
Configuration for the handler.
@@ -1355,7 +1363,7 @@ goto_prev({opts}) *vim.lsp.diagnostic.goto_prev()*
{opts} table See |vim.lsp.diagnostic.goto_next()|
*vim.lsp.diagnostic.on_publish_diagnostics()*
-on_publish_diagnostics({_}, {_}, {params}, {client_id}, {_}, {config})
+on_publish_diagnostics({_}, {result}, {ctx}, {config})
|lsp-handler| for the method "textDocument/publishDiagnostics"
Note:
@@ -1581,7 +1589,7 @@ get({bufnr}) *vim.lsp.codelens.get()*
table ( `CodeLens[]` )
*vim.lsp.codelens.on_codelens()*
-on_codelens({err}, {_}, {result}, {client_id}, {bufnr})
+on_codelens({err}, {result}, {ctx}, {_})
|lsp-handler| for the method `textDocument/codeLens`
refresh() *vim.lsp.codelens.refresh()*
@@ -1614,17 +1622,25 @@ progress_handler({_}, {_}, {params}, {client_id})
See also: ~
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand
- *vim.lsp.handlers.signature_help()*
-signature_help({_}, {method}, {result}, {_}, {bufnr}, {config})
- Parameters: ~
- {config} table Configuration table.
- • border: (default=nil)
- • Add borders to the floating window
- • See |vim.api.nvim_open_win()|
+hover({_}, {result}, {ctx}, {config}) *vim.lsp.handlers.hover()*
+ |lsp-handler| for the method "textDocument/hover" >
+ vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
+ vim.lsp.handlers.hover, {
+ -- Use a sharp border with `FloatBorder` highlights
+ border = "single"
+ }
+ )
+<
See also: ~
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_declaration@seehttps://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_definition@seehttps://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_typeDefinition@seehttps://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_implementation|lsp-handler| for the method "textDocument/signatureHelp">
+ *vim.lsp.handlers.signature_help()*
+signature_help({_}, {result}, {ctx}, {config})
+ |lsp-handler| for the method "textDocument/signatureHelp". The
+ active parameter is highlighted with
+ |hl-LspSignatureActiveParameter|. >
+
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
vim.lsp.handlers.signature_help, {
-- Use a sharp border with `FloatBorder` highlights
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index 16d2fcd424..f29b7a1241 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -1474,14 +1474,12 @@ validate({opt}) *vim.validate()*
vim.validate{arg1={{'foo'}, 'table'}, arg2={'foo', 'string'}}
=> NOP (success)
-<
->
- vim.validate{arg1={1, 'table'}}
- => error('arg1: expected table, got number')
-<
->
- vim.validate{arg1={3, function(a) return (a % 2) == 0 end, 'even number'}}
- => error('arg1: expected even number, got 3')
+
+ vim.validate{arg1={1, 'table'}}
+ => error('arg1: expected table, got number')
+
+ vim.validate{arg1={3, function(a) return (a % 2) == 0 end, 'even number'}}
+ => error('arg1: expected even number, got 3')
<
Parameters: ~
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index 416ea3a08a..eccdc3df15 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -474,11 +474,9 @@ Query:iter_matches({self}, {node}, {source}, {start}, {stop})
for id, node in pairs(match) do
local name = query.captures[id]
-- `node` was captured by the `name` capture in the match
-<
->
- local node_data = metadata[id] -- Node level metadata
-<
->
+
+ local node_data = metadata[id] -- Node level metadata
+
... use the info here ...
end
end