Finn Evers
e42406f9d5
python: Fix incorrect highlighting of function parameters (#26815)
This PR addresses the highlighting of function parameters in Python.
#21454 added various improvements to Python highlighting. However, some
of the capture groups are missing corresponding colors in themes, which
was also [noted on the
PR](https://github.com/zed-industries/zed/pull/21454#pullrequestreview-2537510964).
Currently, this is especially bad for function parameters, which are not
only missing corresponding colors, but are also captured incorrectly as
`arguments` instead of `parameters`. Additionally, as not one theme
defines `function.arguments` (I cheked this with the [extension
surveyor](https://github.com/zed-industries/extension-surveyor), we
instead always fall back to `function` here. Thus, parameters are always
highlighted the same as functions, resulting in incorrect and inproper
highlighting.
This PR resolves this issue by instead capturing parameters as
`variable.parameter`, which has not perfect, but much better coverage
among existing themes.
| `main` | <img width="670" alt="main"
src="https://github.com/user-attachments/assets/6942b494-fe0f-4537-8503-8de4e2c5a30e"
/> |
| --- | --- |
| This PR | <img width="670" alt="PR"
src="https://github.com/user-attachments/assets/f0d1d22a-c5f4-46b8-a22b-f18e0e55fa47"
/> |
---
Following [this
comment](https://github.com/zed-industries/zed/blob/7d9dbbe5feafb0135e05d29f950d5465203690c8/extensions/test-extension/languages/gleam/highlights.scm#L77-L78)
and [the note on the other
PR](https://github.com/zed-industries/zed/pull/21454#discussion_r1907012758),
I also updated the last two matchs in the file to instead use `any-of`
in the second commit (GitHub falsely shows `id` being removed despite it
still being present). Should that not be wanted, I can revert this
change.
Release Notes:
- Fixed improper highlighting of function parameters in Python.
2025-03-31 01:23:03 +02:00
..
2025-03-19 22:00:44 +00:00
2025-02-21 12:01:39 -05:00
2025-03-10 09:10:29 -05:00
2025-03-20 16:45:35 +05:30
2024-12-12 15:18:36 -08:00
2025-03-18 18:18:56 +00:00
2025-02-21 11:32:14 -05:00
2025-01-15 17:44:28 +02:00
2024-03-29 13:55:01 -07:00
2025-03-21 15:13:31 +05:30
2024-12-02 15:01:09 -03:00
2025-03-20 16:45:35 +05:30
2025-03-24 09:46:23 -04:00
2025-03-20 16:45:35 +05:30
2024-08-29 11:23:33 -07:00
2025-03-31 01:23:03 +02:00
2025-03-22 16:11:19 -03:00
2025-03-14 23:02:45 +00:00
2025-03-27 19:15:12 +00:00
2025-03-21 15:13:31 +05:30
2025-02-17 14:55:48 -07:00
2025-02-03 21:34:37 -06:00
2025-03-25 15:13:53 +02:00
2025-02-04 14:50:49 -05:00
2025-03-19 02:09:02 +00:00
2025-03-18 12:55:25 -04:00
2025-03-24 18:56:18 +01:00
2025-03-26 21:08:26 +01:00
2025-03-29 02:10:40 -04:00
2025-02-04 14:50:49 -05:00
2025-01-26 23:37:34 +00:00
2025-01-26 23:37:34 +00:00
2025-01-26 23:37:34 +00:00