nvim-treesitter/runtime/queries/python/injections.scm
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

37 lines
812 B
Scheme

(call
function: (attribute
object: (identifier) @_re)
arguments: (argument_list
(string
(string_start)
[
(string_content) @injection.content
(interpolation)
]+
(string_end)))
(#eq? @_re "re")
(#set! injection.language "regex"))
(call
function: (attribute
object: (identifier) @_re)
arguments: (argument_list
(concatenated_string
(string
(string_start)
[
(string_content) @injection.content
(interpolation)
]+
(string_end))))
(#eq? @_re "re")
(#set! injection.language "regex"))
((binary_operator
left: (string
(string_content) @injection.content)
operator: "%")
(#set! injection.language "printf"))
((comment) @injection.content
(#set! injection.language "comment"))