Skip to content

Commit bb65adf

Browse files
committed
fix: break out of infinite loop when node:parent() is detected
1 parent f2d24ac commit bb65adf

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lua/nvim-ts-autotag/internal.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ local function is_in_template_tag()
4444
local has_template_string = false
4545

4646
local current_node = cursor_node
47+
local visited_nodes = {}
4748
while not (has_element and has_template_string) and current_node do
49+
if visited_nodes[node_id] then
50+
break
51+
end
52+
visited_nodes[node_id] = true
4853
if not has_element and current_node:type() == "element" then
4954
has_element = true
5055
end

0 commit comments

Comments
 (0)