# python: Fix and improve highlighting \(\#25813\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/042fc82e994a22d13418d9b14c9fef93dc010931)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 042fc82e994a22d13418d9b14c9fef93dc010931

Requested commit: 042fc82e994a22d13418d9b14c9fef93dc010931

Commit: 042fc82e994a22d13418d9b14c9fef93dc010931

Tree: b1953d864020d7df9b7b2af246e41ddb58ed6028

Author: Finn Evers

Committer: GitHub

## Message

```
python: Fix and improve highlighting (#25813)

Closes #25803
Closes #25707 

This PR fixes the highlighting regression described in #25803 by fixing
the priorities of highlights as described in the [comment within the
file
itself](https://github.com/zed-industries/zed/blob/5b66ea15638b004c45bbf4e4dd0b576aa6cdcebc/crates/languages/src/python/highlights.scm#L1).
A nice side-effect of this is that scoped constants or other identifiers
are now also more accurately highlighted, as seen in the screenshots
below.

While I was at it, I also adressed the highlighting issue for default
typed idenfiers.

| This PR | <img width="575" alt="PR"
src="https://github.com/user-attachments/assets/aed5cdd0-c31a-4794-8128-376944fddd2d"
/> |
| --- | --- |
| Preview | <img width="575" alt="preview"
src="https://github.com/user-attachments/assets/ae3fad35-d436-472c-aff0-16508304ccf7"
/> |
| Stable | <img width="575" alt="stable"
src="https://github.com/user-attachments/assets/3836427c-f1cc-42ea-b1a7-8f5bbbadf210"
/> |

Release Notes:

- Fixed constants not being highlighted in Python-files.
- Improved Python-highlighting for default function arguments and scoped
identifiers.
```

## Parents

- [27781a8a60ed3b19a633ba207af78765df3c685c](https://git.cafe/gitcafe/zed/commit/27781a8a60ed3b19a633ba207af78765df3c685c?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/042fc82e994a22d13418d9b14c9fef93dc010931?format=markdown)
