Skip to content

Improve Python syntax highlighting#25331

Merged
maxdeviant merged 3 commits intozed-industries:mainfrom
chbk:syntax-py
Feb 21, 2025
Merged

Improve Python syntax highlighting#25331
maxdeviant merged 3 commits intozed-industries:mainfrom
chbk:syntax-py

Conversation

@chbk
Copy link
Contributor

@chbk chbk commented Feb 21, 2025

Release Notes:

  • Improved Python syntax highlighting.
Zed 0.174.6 With this PR
Image Image
  • identifier: variable
  • ., ,, :: punctuation.delimiter
  • @: operator, for matrix multiplication
class Mat(list):
  def __matmul__(self, b):
    ...
a, b = Mat(), Mat()
identifier = a @ b
IDENTIFIER = True

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 21, 2025
@chbk chbk marked this pull request as ready for review February 21, 2025 13:32
@maxdeviant maxdeviant self-assigned this Feb 21, 2025
Copy link
Member

@maxdeviant maxdeviant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@maxdeviant maxdeviant enabled auto-merge (squash) February 21, 2025 20:47
@maxdeviant maxdeviant merged commit 59a153b into zed-industries:main Feb 21, 2025
13 checks passed
maxdeviant added a commit that referenced this pull request Feb 24, 2025
This PR changes the color used for `@variable` syntax highlights in the
Gruvbox themes to be less intense.

We now use the same color as `editor.foreground`.

| Language | Before | After |
| -------- |
-----------------------------------------------------------------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------------------------------------------------------------
|
| Rust | <img width="1410" alt="Screenshot 2025-02-24 at 10 08 41 AM"
src="https://github.com/user-attachments/assets/9a34964d-9fdc-4deb-ac30-4a1c9e6fb531"
/> | <img width="1410" alt="Screenshot 2025-02-24 at 10 55 18 AM"
src="https://github.com/user-attachments/assets/c245d0fd-28af-42b8-93f6-48cb14671d94"
/> |
| Python | <img width="1410" alt="Screenshot 2025-02-24 at 10 08 38 AM"
src="https://github.com/user-attachments/assets/8f8d111e-1d50-4229-a333-eb29b6ce9f4f"
/> | <img width="1410" alt="Screenshot 2025-02-24 at 10 55 20 AM"
src="https://github.com/user-attachments/assets/010b661e-dc9e-4ccb-8e52-ee10c8eb8342"
/> |

In #25333 and #25331 the highlight used for identifiers in Rust and
Python, respectively, was changed to `@variable`, which resulted in the
intense colors you see in the "Before" screenshots above.

We considered reverting the highlight query changes to those languages,
but after taking a look at our other languages, they already use similar
queries. Instead we're adjusting the theme to make these cases less
visually intense.

Release Notes:

- Gruvbox themes: Changed the color used for `@variable` syntax
highlights to be less intense.
@failable
Copy link

failable commented Feb 27, 2025

Dose not seem to work in the latest Zed preview. And I find that I lose all the local variable highlights in functions, variants in Enums, etc. after today's update (Not sure if it is related).

image
Zed: v0.176.0 (Zed Preview) 
OS: macOS 15.3.1
Memory: 64 GiB
Architecture: aarch64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants