python: Improve docstring highlighting (#31628)
This PR broadens the highlighting for docstrings in Python. Previously, only the first docstring for e.g. type aliases was highlighted in Python files. This happened as only the first occurrence in the module was considered a docstring. With this change, now all existing docstrings are actually highlighted as such. | `main` | This PR | | --- | --- | |  |  | Release Notes: - Added more docstring highlights for Python.
This commit is contained in:
parent
50bd8770bd
commit
9cc1851be7
1 changed files with 6 additions and 7 deletions
|
@ -151,6 +151,12 @@
|
|||
"}" @punctuation.special) @embedded
|
||||
|
||||
; Docstrings.
|
||||
([
|
||||
(expression_statement (assignment))
|
||||
(type_alias_statement)
|
||||
]
|
||||
. (expression_statement (string) @string.doc)+)
|
||||
|
||||
(module
|
||||
.(expression_statement (string) @string.doc)+)
|
||||
|
||||
|
@ -173,13 +179,6 @@
|
|||
. (comment) @comment*
|
||||
. (expression_statement (string) @string.doc)+)
|
||||
|
||||
(module
|
||||
[
|
||||
(expression_statement (assignment))
|
||||
(type_alias_statement)
|
||||
]
|
||||
. (expression_statement (string) @string.doc)+)
|
||||
|
||||
(class_definition
|
||||
body: (block
|
||||
(expression_statement (assignment))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue