From 9b262596e05eb1a129a717022b309cd1ad531345 Mon Sep 17 00:00:00 2001 From: Rafik Draoui Date: Sun, 26 Dec 2021 20:54:39 -0500 Subject: 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]: https://github.com/nvim-treesitter/nvim-treesitter/tree/ad69e2528ac382b7cbf28f1ac7ee450981734ab0#adding-queries --- queries/python/injections.scm | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'queries/python') diff --git a/queries/python/injections.scm b/queries/python/injections.scm index db966e6ca..04d0eed1f 100644 --- a/queries/python/injections.scm +++ b/queries/python/injections.scm @@ -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 -- cgit v1.2.3-70-g09d2