From 74ca73d545daf9aff6a6b041572be062d46d51ef Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 12 Apr 2025 10:21:03 -0700 Subject: docs: misc #33330 --- runtime/lua/vim/lsp.lua | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim/lsp.lua') diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index b4b7df8658..9f8e982d3a 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -355,6 +355,8 @@ end --- local cfg = vim.lsp.config.luals --- ``` --- +---@since 13 +--- --- @param name string --- @param cfg vim.lsp.Config --- @diagnostic disable-next-line:assign-type-mismatch @@ -547,6 +549,8 @@ end --- vim.lsp.enable({'luals', 'pyright'}) --- ``` --- +---@since 13 +--- --- @param name string|string[] Name(s) of client(s) to enable. --- @param enable? boolean `true|nil` to enable, `false` to disable. function lsp.enable(name, enable) @@ -635,6 +639,8 @@ end --- Either use |:au|, |nvim_create_autocmd()| or put the call in a --- `ftplugin/.lua` (See |ftplugin-name|) --- +--- @since 10 +--- --- @param config vim.lsp.ClientConfig Configuration for the server. --- @param opts vim.lsp.start.Opts? Optional keyword arguments. --- @return integer? client_id @@ -1016,7 +1022,7 @@ function lsp.buf_is_attached(bufnr, client_id) return lsp.get_clients({ bufnr = bufnr, id = client_id, _uninitialized = true })[1] ~= nil end ---- Gets a client by id, or nil if the id is invalid. +--- Gets a client by id, or nil if the id is invalid or the client was stopped. --- The returned client may not yet be fully initialized. --- ---@param client_id integer client id @@ -1088,6 +1094,8 @@ end --- Get active clients. --- +---@since 12 +--- ---@param filter? vim.lsp.get_clients.Filter ---@return vim.lsp.Client[]: List of |vim.lsp.Client| objects function lsp.get_clients(filter) @@ -1235,6 +1243,8 @@ end --- Sends an async request for all active clients attached to the buffer and executes the `handler` --- callback with the combined result. --- +---@since 7 +--- ---@param bufnr (integer) Buffer handle, or 0 for current. ---@param method (string) LSP method name ---@param params? table|(fun(client: vim.lsp.Client, bufnr: integer): table?) Parameters to send to the server. @@ -1272,6 +1282,8 @@ end --- Parameters are the same as |vim.lsp.buf_request_all()| but the result is --- different. Waits a maximum of {timeout_ms}. --- +---@since 7 +--- ---@param bufnr integer Buffer handle, or 0 for current. ---@param method string LSP method name ---@param params? table|(fun(client: vim.lsp.Client, bufnr: integer): table?) Parameters to send to the server. @@ -1301,6 +1313,9 @@ function lsp.buf_request_sync(bufnr, method, params, timeout_ms) end --- Send a notification to a server +--- +---@since 7 +--- ---@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 @@ -1456,6 +1471,8 @@ end --- }) --- ``` --- +---@since 13 +--- ---@param kind lsp.FoldingRangeKind Kind to close, one of "comment", "imports" or "region". ---@param winid? integer Defaults to the current window. function lsp.foldclose(kind, winid) -- cgit