Skip to content

Commit 81ecc67

Browse files
committed
HACK: manually perform an edit after parsing
1 parent a38c08a commit 81ecc67

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lua/quicker/treesitter.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ function M._attach_lang(buf, lang, regions, register_cbs)
9393
-- which means it only parses visible areas (the on_win and on_line callback),
9494
-- so if we modify the buffer, unvisited area's state get unsynced.
9595
pcall(parser.parse, parser, true)
96+
-- Hack: we need to manually perform an edit, otherwise delete an entire line
97+
-- will cause all highlights to disappear.
98+
vim.api.nvim_buf_call(buf, function()
99+
vim.cmd([[norm! "_xu]])
100+
end)
96101
end
97102

98103
return M

0 commit comments

Comments
 (0)