Skip to content

Commit

Permalink
add util function for hover
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhongjia committed Aug 11, 2023
1 parent 386726a commit 9c64a92
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lua/LspUI/hover/util.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
local lsp = vim.lsp
local hover_feature = lsp.protocol.Methods.textDocument_hover

local M = {}

-- get all valid clients for hover
--- @param buffer_id integer
--- @return lsp.Client[]|nil clients array or nil
M.get_clients = function(buffer_id)
local clients = lsp.get_clients({ bufnr = buffer_id, method = hover_feature })
return #clients == 0 and nil or clients
end

return M

0 comments on commit 9c64a92

Please sign in to comment.