aboutsummaryrefslogtreecommitdiffstats
path: root/lua/lspconfig/util.lua
diff options
context:
space:
mode:
authorranjithshegde <ranjithshegde@gmail.com>2021-11-29 15:05:53 +0100
committerGitHub <noreply@github.com>2021-11-29 09:05:53 -0500
commit8436a197cc76f33fc2dc26145272c66cf5ee193d (patch)
tree199d2043f614fd18026e6d8be8aee37d2eae4edf /lua/lspconfig/util.lua
parentdocs: update server_configurations.md (diff)
downloadnvim-lspconfig-8436a197cc76f33fc2dc26145272c66cf5ee193d.tar
nvim-lspconfig-8436a197cc76f33fc2dc26145272c66cf5ee193d.tar.gz
nvim-lspconfig-8436a197cc76f33fc2dc26145272c66cf5ee193d.tar.bz2
nvim-lspconfig-8436a197cc76f33fc2dc26145272c66cf5ee193d.tar.lz
nvim-lspconfig-8436a197cc76f33fc2dc26145272c66cf5ee193d.tar.xz
nvim-lspconfig-8436a197cc76f33fc2dc26145272c66cf5ee193d.tar.zst
nvim-lspconfig-8436a197cc76f33fc2dc26145272c66cf5ee193d.zip
chore: use client.request instead of buf_request (#1503)
* Use client.request directly instead of vim.lsp.buf_request to call methods that are outside the official LSP specification, such as clangd's "textDocument/switchSourceHeader". * This avoids sending an inapplicable request to all servers, as we cannot ahead of time validate the methods a given server supports.
Diffstat (limited to 'lua/lspconfig/util.lua')
-rw-r--r--lua/lspconfig/util.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua
index b6780aa9..c7f4eb53 100644
--- a/lua/lspconfig/util.lua
+++ b/lua/lspconfig/util.lua
@@ -414,4 +414,12 @@ function M.get_clients_from_cmd_args(arg)
return vim.tbl_values(result)
end
+function M.get_active_client_by_name(bufnr, servername)
+ for _, client in pairs(vim.lsp.buf_get_clients(bufnr)) do
+ if client.name == servername then
+ return client
+ end
+ end
+end
+
return M