Skip to content

fix: highlight variadic type parameter names - #26

Merged
exKAZUu merged 10 commits into
mainfrom
fix/variadic-type-highlights
Oct 19, 2026
Merged

exKAZUu merged 10 commits into
mainfrom
fix/variadic-type-highlights

Conversation

@exKAZUu

@exKAZUu exKAZUu commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Why

Variadic type names such as Ts in class C[*Ts] and P in def 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 verify pass; 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.Ts retain 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.

exKAZUu and others added 4 commits October 19, 2026 03:04
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>
@exKAZUu exKAZUu self-assigned this Oct 18, 2026
exKAZUu and others added 2 commits October 19, 2026 06:33
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
@exKAZUu exKAZUu changed the title fix: highlight variadic type parameter names as types fix: highlight variadic type parameter names Oct 18, 2026
exKAZUu and others added 4 commits October 19, 2026 07:08
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>
@exKAZUu
exKAZUu merged commit 83a59e2 into main Oct 19, 2026
12 checks passed
@exKAZUu
exKAZUu deleted the fix/variadic-type-highlights branch October 19, 2026 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant