aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp.lua
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua/vim/lsp.lua')
-rw-r--r--runtime/lua/vim/lsp.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index ed431e080e..1f9b6c4360 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -1995,6 +1995,7 @@ end
---@field id integer|nil Match clients by id
---@field bufnr integer|nil match clients attached to the given buffer
---@field name string|nil match clients by name
+---@field method string|nil match client by supported method name
--- Get active clients.
---
@@ -2004,6 +2005,7 @@ end
--- - id (number): Only return clients with the given id
--- - bufnr (number): Only return clients attached to this buffer
--- - name (string): Only return clients with the given name
+--- - method (string): Only return clients supporting the given method
---@return lsp.Client[]: List of |vim.lsp.client| objects
function lsp.get_active_clients(filter)
validate({ filter = { filter, 't', true } })
@@ -2020,6 +2022,7 @@ function lsp.get_active_clients(filter)
client
and (filter.id == nil or client.id == filter.id)
and (filter.name == nil or client.name == filter.name)
+ and (filter.method == nil or client.supports_method(filter.method, { bufnr = filter.bufnr }))
then
clients[#clients + 1] = client
end