Skip to content

Filter enclosing syntactic tokens during semantic token merging#2711

Open
somiljain2006 wants to merge 2 commits into
swiftlang:mainfrom
somiljain2006:Token-issue
Open

Filter enclosing syntactic tokens during semantic token merging#2711
somiljain2006 wants to merge 2 commits into
swiftlang:mainfrom
somiljain2006:Token-issue

Conversation

@somiljain2006

@somiljain2006 somiljain2006 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #2708

Update SyntaxHighlightingTokens.mergingTokens to treat containing ranges as overlapping during token merging, allowing more specific semantic tokens to replace enclosing syntactic tokens instead of only removing tokens with identical ranges. This avoids retaining redundant syntactic tokens, such as the attribute modifier covering @TaskLocal when a semantic macro token already exists for TaskLocal, while preserving the existing behavior for unrelated tokens. Add a regression test covering attached macro highlighting.

@somiljain2006

Copy link
Copy Markdown
Contributor Author

@rintaro @ahoppen Can you review this pr?

@ahoppen

ahoppen commented Jul 8, 2026

Copy link
Copy Markdown
Member

@somiljain2006 You don’t need to ping us for a review a few hours after you opened the PR. We get notifications for PRs when they are opened and will review them when we get to them.

Comment thread Sources/SwiftLanguageService/SyntaxHighlightingTokens.swift Outdated
@somiljain2006

somiljain2006 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

@somiljain2006 You don’t need to ping us for a review a few hours after you opened the PR. We get notifications for PRs when they are opened and will review them when we get to them.

Sorry I wasn't sure whether mentioning reviewers was the preferred workflow. I'll avoid pinging for reviews from now on and will wait for the normal review process. Thanks for the clarification.

@somiljain2006 somiljain2006 requested a review from ahoppen July 8, 2026 13:54
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.

@TaskLocal and other attached macro attributes fall through the parser and produce no token

2 participants