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.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index 0ecf57f50c..042ed7bcfe 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -697,6 +697,16 @@ function lsp.get_client_by_id(client_id)
return active_clients[client_id]
end
+-- Look up an active client by its name, returns nil if it is not yet initialized
+-- or is not a valid name.
+-- @param client_name string the client name.
+function lsp.get_client_by_name(client_name)
+ for _, client in pairs(active_clients) do
+ if client.name == client_name then return client end
+ end
+ return nil
+end
+
-- Stop a client by its id, optionally with force.
-- You can also use the `stop()` function on a client if you already have
-- access to it.