feat(python): @string.regex capture, injection improvements (#5697)

* feat(python): `@string.regex` capture, injection improvements

* fix(python): match regex only for first argument of re module

* chore(python): remove unneeded capture

Co-authored-by: Santos Gallegos <stsewd@proton.me>

* fix(python): only highlight string content itself as regex

---------

Co-authored-by: Santos Gallegos <stsewd@proton.me>
This commit is contained in:
Riley Bruins 2023-11-20 08:26:18 -08:00 committed by GitHub
parent 3da5cfb4a2
commit 1610b1aafb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View file

@ -1,10 +1,9 @@
(call
function: (attribute
object: (identifier) @_re)
arguments: (argument_list (string
(string_content) @injection.content) @_string)
arguments: (argument_list . (string
(string_content) @injection.content))
(#eq? @_re "re")
(#lua-match? @_string "^r.*")
(#set! injection.language "regex"))
((comment) @injection.content