diff --git a/lua/nvim-ts-autotag/internal.lua b/lua/nvim-ts-autotag/internal.lua index 16dada3..4664796 100644 --- a/lua/nvim-ts-autotag/internal.lua +++ b/lua/nvim-ts-autotag/internal.lua @@ -256,13 +256,6 @@ 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({ @@ -381,7 +374,7 @@ M.close_tag = function() if not buf_parser then return end - buf_parser:parse() + buf_parser:parse(true) local result, tag_name = check_close_tag() if result == true and tag_name ~= nil then vim.api.nvim_put({ string.format("", tag_name) }, "", true, false) @@ -394,7 +387,7 @@ M.close_slash_tag = function() if not buf_parser then return end - buf_parser:parse() + buf_parser:parse(true) local result, tag_name = check_close_tag(true) if result == true and tag_name ~= nil then vim.api.nvim_put({ string.format("%s>", tag_name) }, "", true, true)