From 7e6e731bce1fdeceed10285e45314afc8b68a092 Mon Sep 17 00:00:00 2001 From: Alex Lachance Date: Mon, 1 Jun 2026 11:07:09 -0400 Subject: [PATCH] python: Fix splat parameter highlighting (#58136) In the current Python Tree-sitter `highlights.scm`, splat parameters (e.g., `*args`, `**kwargs`) and typed splat parameters are not highlighted as `@variable.parameter` due to missing patterns. This PR adds `list_splat_pattern` and `dictionary_splat_pattern` to the function parameter rules so splat parameters are correctly colored. | Before | After | | :---------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------: | | image | image | 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: - Fixed Python splat parameters highlighting --- crates/grammars/src/python/highlights.scm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/grammars/src/python/highlights.scm b/crates/grammars/src/python/highlights.scm index d3230f9b62..620f243a47 100644 --- a/crates/grammars/src/python/highlights.scm +++ b/crates/grammars/src/python/highlights.scm @@ -90,6 +90,16 @@ name: (identifier) @variable.parameter) ; Default parameters (typed_default_parameter name: (identifier) @variable.parameter) ; Typed default parameters + (list_splat_pattern + (identifier) @variable.parameter) ; List splat parameters (*args) + (dictionary_splat_pattern + (identifier) @variable.parameter) ; Dictionary splat parameters (**kwargs) + (typed_parameter + (list_splat_pattern + (identifier) @variable.parameter)) ; Typed list splat parameters + (typed_parameter + (dictionary_splat_pattern + (identifier) @variable.parameter)) ; Typed dictionary splat parameters ])) ; Keyword arguments