Skip to content

Commit

Permalink
fix(watch): use nio.lsp.get_clients
Browse files Browse the repository at this point in the history
See #383
  • Loading branch information
rcarriga committed Mar 20, 2024
1 parent 8026caa commit e07fe82
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lua/neotest/consumers/watch/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ local neotest = {}
---@class neotest.consumers.watch
neotest.watch = {}

local function get_valid_client_id(bufnr)
local sync_clients = vim.lsp.get_active_clients({ bufnr = bufnr })
for _, client in ipairs(sync_clients) do
local function get_valid_client(bufnr)
local clients = nio.lsp.get_clients({ bufnr = bufnr })
for _, client in ipairs(clients) do
---@type nio.lsp.types.ServerCapabilities
local caps = client.server_capabilities
if caps.definitionProvider then
logger.debug("Found client", client.name, "for watch")
return client.id
return client
end
end
end
Expand All @@ -45,9 +45,9 @@ local function get_lsp_client(tree)
for _, buf in ipairs(nio.api.nvim_list_bufs()) do
local path = nio.fn.fnamemodify(nio.api.nvim_buf_get_name(buf), ":p")
if tree:get_key(path) then
local client_id = get_valid_client_id(buf)
if client_id then
return nio.lsp.client(client_id)
local client = get_valid_client(buf)
if client then
return client
end
end
end
Expand Down

0 comments on commit e07fe82

Please sign in to comment.