nvim-treesitter/tests/query/injections/python/test.py
Christian Clason 7248feaca4
Some checks failed
Lint / Lint Lua files (push) Has been cancelled
Lint / Lint query files (push) Has been cancelled
Lint / Lint docs (push) Has been cancelled
Tests / Build (push) Has been cancelled
fix(python): improve f-string injections (#8644)
Problem: Neovim removed match limits, which can lead to catastrophic performance with injection queries.

Solution: Tighten up f-string injections.
2026-07-20 00:29:57 +02:00

28 lines
666 B
Python

import re
re_test = re.compile(r"^(?P<year>\d{4}) (?P<day>\d) \w\s{,3}$")
# ^ @regex
re_test = re.compile(
# comment
# ^ @comment
r"^(?P<year>\d{4}) "
# comment
# ^ @comment
r"(?P<day>\d) \w\s{,3}$"
# ^ @regex
# comment
# comment
# ^ @comment
)
a.a(
f"<td class=\"a{a}\">{a}</td>"
f"<td class=\"a{a}\">{a}</td>"
f"<td class=\"a{a}\">{a}</td>"
f"<td class=\"a{a}\">{a}</td>"
f"<td class=\"a{a}\">{a}</td>"
f"<td class=\"a{a}\">{a}</td>"
f"<td class=\"a{a}\">{a}</td>"
f"<td class=\"a{a}\">{a}</td>"
)
print("foo %s bar %d" % ("arg1", 2))
# ^ @printf