Use name param of get_active_clients in request

This commit is contained in:
Mathias Fussenegger 2023-06-13 16:26:48 +02:00 committed by Mathias Fußenegger
parent dbb8a403e9
commit c4ae99f442

View file

@ -37,13 +37,8 @@ end
local request = function(bufnr, method, params, handler)
local client = nil
for _, c in pairs(vim.lsp.get_active_clients({ bufnr = bufnr })) do
if c.name == 'jdtls' then
client = c
break
end
end
local clients = vim.lsp.get_active_clients({ bufnr = bufnr, name = "jdtls" })
local _, client = next(clients)
if not client then
vim.notify("No LSP client with name `jdtls` available", vim.log.levels.WARN)
return