mirror of
https://github.com/tiyn/action-hints.nvim.git
synced 2025-11-13 13:59:45 +01:00
Make supports_method function public
This commit is contained in:
@@ -52,18 +52,8 @@ local function set_virtual_text(bufnr, line, chunks)
|
||||
last_virtual_text_line = line
|
||||
end
|
||||
|
||||
local function supports_method(method)
|
||||
local clients = vim.lsp.buf_get_clients()
|
||||
for _, client in pairs(clients) do
|
||||
if client.server_capabilities[method] then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function references()
|
||||
if not supports_method("referencesProvider") then
|
||||
if not M.supports_method("referencesProvider") then
|
||||
return
|
||||
end
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
@@ -96,7 +86,7 @@ local function references()
|
||||
end
|
||||
|
||||
local function definition()
|
||||
if not supports_method("definitionProvider") then
|
||||
if not M.supports_method("definitionProvider") then
|
||||
return
|
||||
end
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
@@ -124,6 +114,16 @@ local function definition()
|
||||
end)
|
||||
end
|
||||
|
||||
M.supports_method = function(method)
|
||||
local clients = vim.lsp.buf_get_clients()
|
||||
for _, client in pairs(clients) do
|
||||
if client.server_capabilities[method] then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local debounced_references = debounce(references, 100)
|
||||
local debounced_definition = debounce(definition, 100)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user