diff options
author | Jaehwang Jung <tomtomjhj@gmail.com> | 2023-03-10 06:17:08 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-09 21:17:08 +0000 |
commit | 0ecb4d725e9e2086b045670e4c2fa8962b63d99c (patch) | |
tree | d84eb48560a7f1568530505fa04636af8a45aec8 | |
parent | 68aa2857dd6bc1b33add02121cd36ef1ab32728c (diff) | |
download | rneovim-0ecb4d725e9e2086b045670e4c2fa8962b63d99c.tar.gz rneovim-0ecb4d725e9e2086b045670e4c2fa8962b63d99c.tar.bz2 rneovim-0ecb4d725e9e2086b045670e4c2fa8962b63d99c.zip |
docs(lsp): type annotation for lsp.client (#22509)
* Also fix newly found type mismatch.
* Note that it generates new warnings about using @private client
methods. A proper fix would be to revamp the lsp client documentation
altogether.
-rw-r--r-- | runtime/doc/lsp.txt | 2 | ||||
-rw-r--r-- | runtime/lua/vim/lsp.lua | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index b21ef9d7d3..d13dc4a782 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -655,7 +655,7 @@ buf_notify({bufnr}, {method}, {params}) *vim.lsp.buf_notify()* Send a notification to a server Parameters: ~ - • {bufnr} (number|nil) The number of the buffer + • {bufnr} (integer|nil) The number of the buffer • {method} (string) Name of the request method • {params} (any) Arguments to send to the server diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index cb77e9636f..c85d38a50e 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -154,6 +154,8 @@ local all_buffer_active_clients = {} local uninitialized_clients = {} ---@private +---@param bufnr? integer +---@param fn fun(client: lsp.Client, client_id: integer, bufnr: integer) local function for_each_buffer_client(bufnr, fn, restrict_client_ids) validate({ fn = { fn, 'f' }, @@ -1240,6 +1242,7 @@ function lsp.start_client(config) return end + ---@class lsp.Client local client = { id = client_id, name = name, @@ -1390,7 +1393,7 @@ function lsp.start_client(config) --- checks for capabilities and handler availability. --- ---@param method string LSP method name. - ---@param params table LSP request params. + ---@param params table|nil LSP request params. ---@param handler lsp-handler|nil Response |lsp-handler| for this method. ---@param bufnr integer Buffer handle (0 for current). ---@return boolean status, integer|nil request_id {status} is a bool indicating @@ -2087,7 +2090,7 @@ function lsp.buf_request_sync(bufnr, method, params, timeout_ms) end --- Send a notification to a server ----@param bufnr (number|nil) The number of the buffer +---@param bufnr (integer|nil) The number of the buffer ---@param method (string) Name of the request method ---@param params (any) Arguments to send to the server --- |