Skip to content

Commit 08f311e

Browse files
committed
ui: fix details popup bugs
couple bugs from not handling optional fields in the LSP response. Signed-off-by: ldelossa <louis.delos@gmail.com>
1 parent 686f916 commit 08f311e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lua/calltree/ui/details.lua

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ function M.details_popup(node, direction, calltree_buffer)
3939
vim.api.nvim_buf_set_option(buf, 'syntax', 'yaml')
4040

4141
local lines = {}
42-
table.insert(lines, "Symbol Details")
43-
table.insert(lines, "==============")
42+
table.insert(lines, "==Symbol Details==")
4443
table.insert(lines, "Name: " .. node.name)
4544
table.insert(lines, "Kind: " .. vim.lsp.protocol.SymbolKind[node.kind])
4645

@@ -51,8 +50,16 @@ function M.details_popup(node, direction, calltree_buffer)
5150
if node.references ~= nil then
5251
table.insert(lines, "References: " .. #node.references)
5352
end
53+
5454
table.insert(lines, "File: " .. lsp_util.relative_path_from_uri(node.call_hierarchy_obj.uri))
55-
table.insert(lines, "Details: " .. node.call_hierarchy_obj.detail)
55+
56+
if node.call_hierarchy_obj.detail ~= nil then
57+
table.insert(lines, "Details: " .. node.call_hierarchy_obj.detail)
58+
end
59+
60+
if node.call_hierarchy_obj.data ~= nil then
61+
table.insert(lines, "Data: " .. node.call_hierarchy_obj.data)
62+
end
5663

5764
local width = 20
5865
for _, line in ipairs(lines) do

0 commit comments

Comments
 (0)