mirror of
https://github.com/windwp/nvim-ts-autotag.git
synced 2025-01-04 17:49:20 -06:00
fix: reparse source if the node has changes
This commit is contained in:
parent
462b04fd96
commit
e9e94e7fc5
@ -256,6 +256,13 @@ local function find_tag_node(opt)
|
||||
local name_tag_pattern = opt.name_tag_pattern
|
||||
local skip_tag_pattern = opt.skip_tag_pattern
|
||||
local find_child = opt.find_child or false
|
||||
--- PERF: Some parsers don't seemingly pick up their trees correctly, so we have to reparse the
|
||||
--- entire source. This is slow, see if we can avoid this.
|
||||
if target and target:has_changes() then
|
||||
local parser = vim.treesitter.get_parser()
|
||||
_ = (parser and parser:parse(true) or nil)
|
||||
target = ts_utils.get_node_at_cursor()
|
||||
end
|
||||
local node
|
||||
if find_child then
|
||||
node = find_child_match({
|
||||
|
Loading…
Reference in New Issue
Block a user