Skip to content

Conversation

@PhantomInTheWire
Copy link

@PhantomInTheWire PhantomInTheWire commented Dec 18, 2025

Motivation: Argument labels are currently tokenized as function without any modifier, making them indistinguishable from function names. This prevents theme authors from styling them differently, particularly important for accessibility (e.g., themes for neurodivergent developers) and personal preference.

Changes:

  • Added parameterLabel semantic token modifier to SemanticTokenModifiers extension
  • Applied the modifier to argument labels in both the syntactic path (SemanticTokens.swift) and semantic path (SyntaxHighlightingTokenParser.swift) to ensure consistency.
  • Updated the token legend to include the new modifier so editors can decode it.
  • Updated all(?) relevant test expectations to include .parameterLabel for argument label tokens.

Fixes #1540

@PhantomInTheWire PhantomInTheWire force-pushed the feat/add-parameterLabel-modifier branch from 02d3446 to 80f905b Compare December 18, 2025 22:02
Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Looks good to me, I’d just like to define the modifier in swift-tools-protocols.

extension SemanticTokenModifiers {
// Argument labels are considered part of the function name, but this modifier
// allows themes to style them differently if desired.
package static var parameterLabel: Self { Self(rawValue: UInt32(1) << UInt32(SemanticTokenModifiers.all.count)) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add this to the definition of SemanticTokenModifiers in swift-tools-protocols?

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.

Parameter label as function token

2 participants