treesitter: update to use buf_set_extmark

This commit is contained in:
Thomas Vigouroux
2020-08-31 11:54:24 +02:00
parent 49f5b57587
commit 1832d18083

View File

@@ -98,7 +98,7 @@ function TSHighlighter:get_hl_from_capture(capture)
return vim.split(name, '.', true)[1] return vim.split(name, '.', true)[1]
else else
-- Default to false to avoid recomputing -- Default to false to avoid recomputing
return TSHighlighter.hl_map[name] return a.nvim_get_hl_id_by_name(TSHighlighter.hl_map[name])
end end
end end
@@ -142,10 +142,11 @@ function TSHighlighter:on_changedtree(changes)
local start_row, start_col, end_row, end_col = node:range() local start_row, start_col, end_row, end_col = node:range()
local hl = self.hl_cache[capture] local hl = self.hl_cache[capture]
if hl then if hl then
a.nvim__buf_add_decoration(self.buf, ts_hs_ns, hl, a.nvim_buf_set_extmark(self.buf, ts_hs_ns, start_row, start_col, {
start_row, start_col, end_col = end_col,
end_row, end_col, end_line = end_row,
{}) hl_group = hl
})
end end
end end
end end