aboutsummaryrefslogtreecommitdiffstats
path: root/queries/python
diff options
context:
space:
mode:
Diffstat (limited to 'queries/python')
-rw-r--r--queries/python/injections.scm18
1 files changed, 18 insertions, 0 deletions
diff --git a/queries/python/injections.scm b/queries/python/injections.scm
index feec13f73..de108262d 100644
--- a/queries/python/injections.scm
+++ b/queries/python/injections.scm
@@ -4,3 +4,21 @@
arguments: (argument_list (string) @regex))
(#eq? @_re "re")
(#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))