Skip to content

Commit

Permalink
[enhance]: get clients
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhongjia committed Feb 7, 2024
1 parent cefdb7d commit b8b3f30
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
5 changes: 4 additions & 1 deletion lua/LspUI/code_action/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ local M = {}
M.get_clients = function(buffer_id)
local clients =
lsp.get_clients({ bufnr = buffer_id, method = code_action_feature })
return #clients == 0 and nil or clients
if vim.tbl_isempty(clients) then
return nil
end
return clients
end

-- make range params
Expand Down
5 changes: 4 additions & 1 deletion lua/LspUI/hover/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ local hover_tuple_index
M.get_clients = function(buffer_id)
local clients =
lsp.get_clients({ bufnr = buffer_id, method = hover_feature })
return #clients == 0 and nil or clients
if vim.tbl_isempty(clients) then
return nil
end
return clients
end

-- get hovers from lsp
Expand Down
5 changes: 4 additions & 1 deletion lua/LspUI/lightbulb/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ local autocmd_list = {}
M.get_clients = function(buffer_id)
local clients =
lsp.get_clients({ bufnr = buffer_id, method = code_action_feature })
return #clients == 0 and nil or clients
if vim.tbl_isempty(clients) then
return nil
end
return clients
end

-- render sign
Expand Down
5 changes: 4 additions & 1 deletion lua/LspUI/signature/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ end
M.get_clients = function(buffer_id)
local clients =
lsp.get_clients({ bufnr = buffer_id, method = signature_feature })
return #clients == 0 and nil or clients
if vim.tbl_isempty(clients) then
return nil
end
return clients
end

--- @type function
Expand Down

0 comments on commit b8b3f30

Please sign in to comment.