From c53bb10a71a04860758757b190620814b4993a77 Mon Sep 17 00:00:00 2001 From: Lev Velykoivanenko Date: Sun, 26 Oct 2025 17:25:42 +0100 Subject: fix(python): regex injection not working for concatenated strings (#8197) Co-authored-by: Riley Bruins --- runtime/queries/python/highlights.scm | 10 +++++++++- runtime/queries/python/injections.scm | 14 +++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'runtime/queries/python') diff --git a/runtime/queries/python/highlights.scm b/runtime/queries/python/highlights.scm index 70f6d9acc..350990b1f 100644 --- a/runtime/queries/python/highlights.scm +++ b/runtime/queries/python/highlights.scm @@ -417,11 +417,19 @@ function: (attribute object: (identifier) @_re) arguments: (argument_list - . (string (string_content) @string.regexp)) (#eq? @_re "re")) +(call + function: (attribute + object: (identifier) @_re) + arguments: (argument_list + (concatenated_string + (string + (string_content) @string.regexp))) + (#eq? @_re "re")) + ; Decorators ((decorator "@" @attribute) diff --git a/runtime/queries/python/injections.scm b/runtime/queries/python/injections.scm index bbc924be4..2a120d9b5 100644 --- a/runtime/queries/python/injections.scm +++ b/runtime/queries/python/injections.scm @@ -2,12 +2,24 @@ function: (attribute object: (identifier) @_re) arguments: (argument_list - . (string (string_content) @injection.content)) (#eq? @_re "re") (#set! injection.language "regex")) +(call + function: (attribute + object: (identifier) @_re) + arguments: (argument_list + (concatenated_string + [ + (string + (string_content) @injection.content) + (comment) + ]+)) + (#eq? @_re "re") + (#set! injection.language "regex")) + ((binary_operator left: (string (string_content) @injection.content) -- cgit v1.2.3-70-g09d2