Repository navigation
fix: highlight variadic type parameter names - #26
Merged
Merged
Conversation
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Variadic type names such as
Tsinclass C[*Ts]andPindef f[**P]()receive constructor or constant colors from naming heuristics instead of type colors.Requirements
required: Improve our forked tree-sitter repositories and address eligible items in dedicated PRs after checking for duplicates; backward compatibility is not required.
chosen: Highlight variadic names in type positions as types, including declaration parameters, unpacked generic arguments, and star-parameter annotations, matching their syntactic role.
chosen: Capture identifiers beneath splat_type directly: every production and alias of that node denotes a type position. Restricting its parent to type_parameter misses typed_parameter annotations such as *args: *Ts; ordinary variables and value unpacking use different nodes.
chosen: Render all highlight fixtures through the existing testCommand runner, which terminates the entire child process group and derives the test timeout from the command timeout; the synchronous helper bounded only the direct CLI child and duplicated timeout settings.
chosen: Include unpacked generic arguments in direct class-base subscripts, where the grammar emits list_splat rather than splat_type; PEP 646 explicitly uses Generic[*Shape] as a base. Keep the capture scoped to class bases so ordinary value unpacking retains its non-type highlighting.
chosen: Negative highlight controls assert that ordinary assignments and value unpacking are not types, without pinning unrelated constructor/constant naming heuristics.
chosen: Keep this PR focused on bare variadic-name captures. Composite unpacked operands already have the same missing type captures on published 2.3.1 (tuple/int/str and typing.Ts controls); their grammar/query repair is a separate upstream-audit item, not a regression introduced here.
chosen: Handle qualified annotation subscripts in a separate follow-up: typing.Tuple[*Ts], typing.Tuple[int, *Us], and collections.abc.Sequence[*Ts] produce identical missing type captures on published 2.3.1 and this head. This PR repairs the existing splat_type and direct class-base captures.
chosen: Retain explicit highlight CLI arguments in the three fixture tests. Process-group handling and timeout derivation are shared in testCommand; extracting only the identical argument array and timeout changes no behavior, contract, or verification result and addresses no failing control.
Customer Summary
Variadic type parameters, unpacked type arguments, and star-parameter annotations receive type highlighting.
Technical Summary
The shipped highlight query captures identifiers beneath
splat_type, which only denotes type positions. A scoped class-base pattern also covers the list_splat nodes used by unpacked generic bases. A CLI-rendered HTML check covers class, function, type-alias, generic-argument and star-parameter annotation positions alongside ordinary variables.Testing
The variadic, lazy-import, and default-type highlight fixtures use the existing process-group-aware CLI runner, with the test timeout derived from the command timeout. Eight tests across six files pass, including all rendered-highlight assertions, type-parameter expression controls, and 207 native and Wasm corpus cases after integrating nested generic calls.
The original rendered-highlight regression fails on the baseline and passes with the query change. Generic and qualified generic base-class regressions also fail before their query repair; assignments and value unpacking remain non-type controls without pinning naming-heuristic colors. Class-base variadics follow PEP 646. Canonical generation and
bun run verifypass; no code-gauge violations occur in changed code. Full platform checks run in CI.Notes
Composite unpacked annotations such as
*args: *tuple[int, str]and*args: *typing.Tsretain their pre-existing missing type highlights and are queued for a separate fix.Qualified annotation subscripts such as
typing.Tuple[*Ts]retain their pre-existing missing type capture and are queued separately.