nvim-treesitter/queries/python/injections.scm
Lewis Russell 011ac894ec Prefer lua-match over match
as string.find is much quicker than vim.regex:match*
2021-11-23 10:02:06 +01:00

26 lines
653 B
Scheme

((call
function: (attribute
object: (identifier) @_re)
arguments: (argument_list (string) @regex))
(#eq? @_re "re")
(#lua-match? @regex "^r.*"))
; Module docstring
((module . (expression_statement (string) @rst))
(#offset! @rst 0 3 0 -3))
; Class docstring
((class_definition
body: (block . (expression_statement (string) @rst)))
(#offset! @rst 0 3 0 -3))
; Function/method docstring
((function_definition
body: (block . (expression_statement (string) @rst)))
(#offset! @rst 0 3 0 -3))
; Attribute docstring
(((expression_statement (assignment)) . (expression_statement (string) @rst))
(#offset! @rst 0 3 0 -3))
(comment) @comment