python: Add dunder variables highlighting (#58158)
In the current Python Tree-sitter `highlights.scm`, dunder variables (e.g., `__name__`, `__file__`) are not highlighted. This PR adds a regex `#match?` so all dunder variables are highlighted under `@attribute.special`. An alternative solution would be to use `#any-of?` and list all dunder variables. | Before | After | | :---------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------: | |<img width="623" height="895" alt="image" src="https://github.com/user-attachments/assets/ad7b67ba-541c-40ac-a38a-cc863e417fcc" /> | <img width="612" height="903" alt="image" src="https://github.com/user-attachments/assets/a91f5efb-230a-4214-b16b-04278b3ef9ee" />| Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Added Python dunder variables highlighting via `attribute.special` in themes.
A
Alex Lachance committed
b914ba5cb3f4619450ad0de38adbb6b215752b74
Parent: 51db7df
Committed by GitHub <noreply@github.com>
on 8/6/2026, 3:29:26 PM