diff options
author | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-09-05 10:27:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-05 10:27:52 -0700 |
commit | 23fe6dba138859c1c22850b9ce76219141f546a0 (patch) | |
tree | 297bca80ff0ad1f442d6a4f36db88c5509c455e0 /runtime/doc | |
parent | 7a0468e7addc8745d82abdfb62d25714f38dae8f (diff) | |
parent | f7dabbc115296d7d821985fb77d63a2958d48be3 (diff) | |
download | rneovim-23fe6dba138859c1c22850b9ce76219141f546a0.tar.gz rneovim-23fe6dba138859c1c22850b9ce76219141f546a0.tar.bz2 rneovim-23fe6dba138859c1c22850b9ce76219141f546a0.zip |
Merge pull request #15504 from mjlbach/feat/change-handler-signature
feat(lsp)!: change handler signature
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/lsp.txt | 47 | ||||
-rw-r--r-- | runtime/doc/lua.txt | 14 | ||||
-rw-r--r-- | runtime/doc/treesitter.txt | 8 |
3 files changed, 36 insertions, 33 deletions
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 0c94b79600..e76e224596 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. @@ -1403,7 +1411,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: @@ -1682,7 +1690,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()* @@ -1710,8 +1718,7 @@ save({lenses}, {bufnr}, {client_id}) *vim.lsp.codelens.save()* ============================================================================== Lua module: vim.lsp.handlers *lsp-handlers* - *vim.lsp.handlers.hover()* -hover({_}, {method}, {result}, {_}, {_}, {config}) +hover({_}, {result}, {ctx}, {config}) *vim.lsp.handlers.hover()* |lsp-handler| for the method "textDocument/hover" > vim.lsp.handlers["textDocument/hover"] = vim.lsp.with( @@ -1729,7 +1736,7 @@ hover({_}, {method}, {result}, {_}, {_}, {config}) • See |vim.api.nvim_open_win()| *vim.lsp.handlers.signature_help()* -signature_help({_}, {method}, {result}, {client_id}, {bufnr}, {config}) +signature_help({_}, {result}, {ctx}, {config}) |lsp-handler| for the method "textDocument/signatureHelp". The active parameter is highlighted with |hl-LspSignatureActiveParameter|. > diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 3df57a3460..a44b2e42f5 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1581,14 +1581,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 379523722e..a509c328e5 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -531,11 +531,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 |