fix(writer): Ensure all buffer namespaces are cleared

...before setting highlights

Closes #38
This commit is contained in:
hedy
2023-11-25 11:18:16 +08:00
parent dc0d37e799
commit 44fdeac29a

View File

@@ -35,8 +35,8 @@ function M.add_highlights(bufnr, hl_info, nodes)
end end
---@param bufnr integer ---@param bufnr integer
local function clear_virt_text(bufnr) local function clear_all_ns(bufnr)
vim.api.nvim_buf_clear_namespace(bufnr, vtns, 0, -1) vim.api.nvim_buf_clear_namespace(bufnr, -1, 0, -1)
end end
---@param bufnr integer ---@param bufnr integer
@@ -79,7 +79,7 @@ function M.make_outline(bufnr, items, codewin, find_node)
-- Deepest matching node to put cursor on based on hovered line -- Deepest matching node to put cursor on based on hovered line
local put_cursor local put_cursor
clear_virt_text(bufnr) clear_all_ns(bufnr)
---@type string[] ---@type string[]
local lines = {} local lines = {}