treesitter: revert wrong optimization in highlights

This commit is contained in:
Thomas Vigouroux 2020-09-02 09:21:53 +02:00
parent 59712f6dbe
commit 1ff064126d
2 changed files with 24 additions and 5 deletions

View File

@ -134,12 +134,9 @@ function TSHighlighter:on_changedtree(changes)
self.root = self.parser.tree:root()
for _, ch in ipairs(changes or {}) do
-- Try to be as exact as possible
local changed_node = self.root:descendant_for_range(ch[1], ch[2], ch[3], ch[4])
a.nvim_buf_clear_namespace(self.buf, ts_hs_ns, ch[1], ch[3] + 1)
a.nvim_buf_clear_namespace(self.buf, ts_hs_ns, ch[1], ch[3])
for capture, node in self.query:iter_captures(changed_node, self.buf, ch[1], ch[3] + 1) do
for capture, node in self.query:iter_captures(self.root, self.buf, ch[1], ch[3] + 1) do
local start_row, start_col, end_row, end_col = node:range()
local hl = self.hl_cache[capture]
if hl then

View File

@ -445,6 +445,28 @@ static int nlua_schedule(lua_State *const lstate)
|
]]}
feed("5Goc<esc>dd")
screen:expect{grid=[[
{2:/// Schedule Lua callback on main loop's event queue} |
{3:static} {3:int} {11:nlua_schedule}({3:lua_State} *{3:const} lstate) |
{ |
{4:if} ({11:lua_type}(lstate, {5:1}) != {5:LUA_TFUNCTION} |
|| {6:lstate} != {6:lstate}) { |
{11:^lua_pushliteral}(lstate, {5:"vim.schedule: expected function"}); |
{4:return} {11:lua_error}(lstate); |
} |
|
{7:LuaRef} cb = {11:nlua_ref}(lstate, {5:1}); |
|
multiqueue_put(main_loop.events, {11:nlua_schedule_event}, |
{5:1}, ({3:void} *)({3:ptrdiff_t})cb); |
{4:return} {5:0}; |
} |
{1:~ }|
{1:~ }|
|
]]}
feed('7Go*/<esc>')
screen:expect{grid=[[
{2:/// Schedule Lua callback on main loop's event queue} |