fix(treesitter): don't invalidate parser when discovering injections

When parsing with a range, languagetree looks up injections and adds
them if needed. This explicitly invalidates parser, making `is_valid`
report `false` both when including and excluding children.

This is an attempt to describe desired behaviour of `is_valid` in tests,
with what ended up being a single line change to satisfy them.
This commit is contained in:
Dmytro Soltys
2023-11-27 13:34:32 +01:00
committed by Christian Clason
parent 40139738eb
commit 72ed99319d
2 changed files with 117 additions and 2 deletions

View File

@@ -508,7 +508,6 @@ function LanguageTree:add_child(lang)
end
self._children[lang] = child
self:invalidate()
self:_do_callback('child_added', self._children[lang])
return self._children[lang]
@@ -524,7 +523,6 @@ function LanguageTree:remove_child(lang)
if child then
self._children[lang] = nil
child:destroy()
self:invalidate()
self:_do_callback('child_removed', child)
end
end