fix(lsp): handle empty call hierarchy items (#3288)
- 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.
This commit is contained in:
@@ -50,7 +50,7 @@ local function call_hierarchy(opts, method, title, direction, item)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function pick_call_hierarchy_item(call_hierarchy_items)
|
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
|
return
|
||||||
end
|
end
|
||||||
if #call_hierarchy_items == 1 then
|
if #call_hierarchy_items == 1 then
|
||||||
@@ -65,7 +65,7 @@ local function pick_call_hierarchy_item(call_hierarchy_items)
|
|||||||
if choice < 1 or choice > #items then
|
if choice < 1 or choice > #items then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
return choice
|
return call_hierarchy_items[choice]
|
||||||
end
|
end
|
||||||
|
|
||||||
local function calls(opts, direction)
|
local function calls(opts, direction)
|
||||||
|
|||||||
Reference in New Issue
Block a user