buffer updates: add on_reload callback and handle it in treesitter parser

This commit is contained in:
Björn Linse
2021-02-07 07:32:19 +01:00
parent fa5f583981
commit 94622ca66b
9 changed files with 146 additions and 62 deletions

View File

@@ -51,7 +51,11 @@ function M._create_parser(bufnr, lang, opts)
self:_on_detach(...)
end
a.nvim_buf_attach(self:source(), false, {on_bytes=bytes_cb, on_detach=detach_cb, preview=true})
local function reload_cb(_, ...)
self:_on_reload(...)
end
a.nvim_buf_attach(self:source(), false, {on_bytes=bytes_cb, on_detach=detach_cb, on_reload=reload_cb, preview=true})
self:parse()