diff options
author | Lewis Russell <lewis6991@gmail.com> | 2023-04-30 16:11:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-30 17:11:38 +0200 |
commit | 19a793545f15bb7e0bac2fc8f705c600e8f9c9bb (patch) | |
tree | 9fd9adc5f9c321469acbf7631241bf929ad5c451 /runtime/doc/treesitter.txt | |
parent | 7e3d6ff4053b47a92067f7d68ba6f541ea89dee0 (diff) | |
download | rneovim-19a793545f15bb7e0bac2fc8f705c600e8f9c9bb.tar.gz rneovim-19a793545f15bb7e0bac2fc8f705c600e8f9c9bb.tar.bz2 rneovim-19a793545f15bb7e0bac2fc8f705c600e8f9c9bb.zip |
fix(treesitter): redraw added/removed injections properly (#23287)
When injections are added or removed make sure to:
- invoke 'changedtree' callbacks for when new trees are added.
- invoke 'changedtree' callbacks for when trees are invalidated
- redraw regions when languagetree children are removed
Diffstat (limited to 'runtime/doc/treesitter.txt')
-rw-r--r-- | runtime/doc/treesitter.txt | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 94690f0b7f..0168b11499 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -1149,21 +1149,24 @@ LanguageTree:parse({self}) *LanguageTree:parse()* Return: ~ TSTree[] -LanguageTree:register_cbs({self}, {cbs}) *LanguageTree:register_cbs()* + *LanguageTree:register_cbs()* +LanguageTree:register_cbs({self}, {cbs}, {recursive}) Registers callbacks for the |LanguageTree|. Parameters: ~ - • {cbs} (table) An |nvim_buf_attach()|-like table argument with the - following handlers: - • `on_bytes` : see |nvim_buf_attach()|, but this will be called after the parsers callback. - • `on_changedtree` : a callback that will be called every time - the tree has syntactical changes. It will only be passed one - argument, which is a table of the ranges (as node ranges) - that changed. - • `on_child_added` : emitted when a child is added to the - tree. - • `on_child_removed` : emitted when a child is removed from - the tree. + • {cbs} (table) An |nvim_buf_attach()|-like table argument with + the following handlers: + • `on_bytes` : see |nvim_buf_attach()|, but this will be called after the parsers callback. + • `on_changedtree` : a callback that will be called + every time the tree has syntactical changes. It will + only be passed one argument, which is a table of the + ranges (as node ranges) that changed. + • `on_child_added` : emitted when a child is added to + the tree. + • `on_child_removed` : emitted when a child is removed + from the tree. + • {recursive?} boolean Apply callbacks recursively for all children. + Any new children will also inherit the callbacks. • {self} LanguageTree:source({self}) *LanguageTree:source()* |