fix: break out of infinite loop when node:parent() is detected

This commit is contained in:
Pierre-Nicolas Watin-Augouard 2024-12-02 12:21:00 +01:00
parent f2d24aca1b
commit bb65adf1df
No known key found for this signature in database

View File

@ -44,7 +44,12 @@ local function is_in_template_tag()
local has_template_string = false
local current_node = cursor_node
local visited_nodes = {}
while not (has_element and has_template_string) and current_node do
if visited_nodes[node_id] then
break
end
visited_nodes[node_id] = true
if not has_element and current_node:type() == "element" then
has_element = true
end