Skip to content

Commit

Permalink
feat: use client.supports_method instead of client.server_capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
rcasia committed Sep 6, 2024
1 parent 6d6ad11 commit d9dcc1d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lua/neotest/consumers/watch/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ neotest.watch = {}
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

local has_definition_support = client.supports_method
and client.supports_method('textDocument/definition')
-- for compatibility with Neovim versions earlier than v0.10.1
or client.server_capabilities.definitionProvider

if has_definition_support then
logger.debug("Found client", client.name, "for watch")
return client
end
Expand Down

0 comments on commit d9dcc1d

Please sign in to comment.