Skip to content

Commit f2ecd83

Browse files
committed
refactor(#2731): resolve warnings, type gymnastics
1 parent b52a4af commit f2ecd83

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lua/nvim-tree/renderer/components/full-name.lua

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,20 @@ local function show()
6767
})
6868

6969
local ns_id = vim.api.nvim_get_namespaces()["NvimTreeHighlights"]
70-
local extmarks = vim.api.nvim_buf_get_extmarks(0, ns_id, { line_nr - 1, 0 }, { line_nr - 1, -1 }, { details = 1 })
70+
local extmarks = vim.api.nvim_buf_get_extmarks(0, ns_id, { line_nr - 1, 0 }, { line_nr - 1, -1 }, { details = true })
7171
vim.api.nvim_win_call(M.popup_win, function()
7272
vim.api.nvim_buf_set_lines(0, 0, -1, true, { line })
7373
for _, extmark in ipairs(extmarks) do
74-
local hl = extmark[4]
75-
vim.api.nvim_buf_add_highlight(0, ns_id, hl.hl_group, 0, extmark[3], hl.end_col)
74+
75+
---nvim 0.10 luadoc is incorrect: vim.api.keyset.get_extmark_item is missing the extmark_id at the start
76+
77+
---@cast extmark table
78+
---@type integer
79+
local col = extmark[3]
80+
---@type vim.api.keyset.extmark_details
81+
local details = extmark[4]
82+
83+
vim.api.nvim_buf_add_highlight(0, ns_id, details.hl_group, 0, col, details.end_col)
7684
end
7785
vim.cmd [[ setlocal nowrap cursorline noswapfile nobuflisted buftype=nofile bufhidden=hide ]]
7886
end)

0 commit comments

Comments
 (0)