Skip to content

Commit

Permalink
fix(lsp): handle empty call hierarchy items (#3288)
Browse files Browse the repository at this point in the history
- Added a check for empty call hierarchy items using vim.tbl_isempty.
- Fixed the return value to correctly return the chosen item from the
  list.
  • Loading branch information
jamestrew authored Sep 12, 2024
1 parent f898564 commit cfaf684
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/telescope/builtin/__lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ local function call_hierarchy(opts, method, title, direction, item)
end

local function pick_call_hierarchy_item(call_hierarchy_items)
if not call_hierarchy_items then
if not call_hierarchy_items or vim.tbl_isempty(call_hierarchy_items) then
return
end
if #call_hierarchy_items == 1 then
Expand All @@ -65,7 +65,7 @@ local function pick_call_hierarchy_item(call_hierarchy_items)
if choice < 1 or choice > #items then
return
end
return choice
return call_hierarchy_items[choice]
end

local function calls(opts, direction)
Expand Down

0 comments on commit cfaf684

Please sign in to comment.