fix(treesitter): remove redundant on_bytes callback #31041

Problem:  Treesitter highlighter implements an on_bytes callback that
          just re-marks a buffer range for redraw. The edit that
          prompted the callback will already have done that.
Solution: Remove redundant on_bytes callback from the treesitter
          highlighter module.
This commit is contained in:
luukvbaal
2024-11-17 01:25:10 +01:00
committed by GitHub
parent 9c718bc2bc
commit cdc9baeaf8
3 changed files with 2 additions and 13 deletions

View File

@@ -93,9 +93,6 @@ function TSHighlighter.new(tree, opts)
opts = opts or {} ---@type { queries: table<string,string> }
self.tree = tree
tree:register_cbs({
on_bytes = function(...)
self:on_bytes(...)
end,
on_detach = function()
self:on_detach()
end,
@@ -214,13 +211,6 @@ function TSHighlighter:for_each_highlight_state(fn)
end
end
---@package
---@param start_row integer
---@param new_end integer
function TSHighlighter:on_bytes(_, _, start_row, _, _, _, _, _, new_end)
api.nvim__redraw({ buf = self.bufnr, range = { start_row, start_row + new_end + 1 } })
end
---@package
function TSHighlighter:on_detach()
self:destroy()