Skip to content

Conversation

@alfredomtx
Copy link

@alfredomtx alfredomtx commented Jan 13, 2026

Summary

Adds syntax highlighting for PHP 8+ named arguments in function/method calls.

Named arguments like id:, firstName:, lastName: in:

$this->users->map(fn (User $user) => new UserDTO(
    id: $user->id,
    firstName: $user->first_name,
    lastName: $user->last_name,
));

Are now highlighted with the @label token, which themes can style distinctly (e.g., JetBrains IDEs use a muted blue for these).

Implementation

Added a simple tree-sitter query that captures the name field of argument nodes:

(argument
  name: (name) @label)

The tree-sitter-php grammar already exposes the name field on argument nodes for named arguments, so no grammar changes are needed.

Test plan

  • Tested locally with zed: install dev extension
  • Named arguments now highlight correctly in PHP files

@cla-bot cla-bot bot added the cla-signed label Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant