Improve Python syntax highlighting (#12868)

Release Notes:

- Improve syntax highlighting in Python #12578 

Before:
<img width="1181" alt="Screenshot 2024-06-08 at 01 44 54"
src="https://github.com/zed-industries/zed/assets/87859239/0b8ab26b-149b-477e-af08-8cd9f2b1c117">

After:

<img width="1184" alt="Screenshot 2024-06-10 at 01 02 35"
src="https://github.com/zed-industries/zed/assets/87859239/a319a5ea-54b7-4681-951d-130ea26aa390">

---------

Co-authored-by: Joseph T Lyons <JosephTLyons@gmail.com>
This commit is contained in:
Nigel Jose 2024-06-18 19:21:18 +03:00 committed by GitHub
parent 5ede48337c
commit ba59e66314
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,25 @@
(parameter (identifier) @variable)
(attribute attribute: (identifier) @property)
(type (identifier) @type)
; Module imports
(import_statement
(dotted_name (identifier) @type))
(import_statement
(aliased_import
name: (dotted_name (identifier) @type)
alias: (identifier) @type))
(import_from_statement
(dotted_name (identifier) @type))
(import_from_statement
(aliased_import
name: (dotted_name (identifier) @type)
alias: (identifier) @type))
; Function calls
(decorator) @function
@ -44,9 +63,13 @@
(float)
] @number
; Variables
(assignment
left: (identifier) @variable)
; Self references
[
(parameters (identifier) @variable.special)
(attribute (identifier) @variable.special)
(#match? @variable.special "^self$")
]
(comment) @comment
(string) @string