Remove Python docstring injections

These injections lead to inconsistent highlighting since some edge cases
aren't handled (as mentioned in the PR description that introduced the
injections [0]). Besides, not all Python projects use reStructuredText
syntax in docstrings.

If someone still wants to use them, they can extend the base injection
queries through `after/queries/` [1] or enable them with
`vim.treesitter.set_query`.

See also: https://github.com/nvim-treesitter/nvim-treesitter/pull/1204

[0]: https://github.com/nvim-treesitter/nvim-treesitter/pull/917
[1]: ad69e2528a (adding-queries)
This commit is contained in:
Rafik Draoui 2021-12-26 20:54:39 -05:00 committed by Stephan Seitz
parent 479fde3471
commit 9b262596e0

View file

@ -5,22 +5,4 @@
(#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