Skip to content

Fix Swift label highlight captures#76

Open
ollieatkinson wants to merge 1 commit into
zed-extensions:mainfrom
ollieatkinson:fix/issue-74-parameter-label-highlighting
Open

Fix Swift label highlight captures#76
ollieatkinson wants to merge 1 commit into
zed-extensions:mainfrom
ollieatkinson:fix/issue-74-parameter-label-highlighting

Conversation

@ollieatkinson
Copy link
Copy Markdown

Summary

Fix Swift Tree-sitter highlight captures so function parameter labels/names and call argument labels are not classified as @property.

This keeps themes from having to style Swift labels the same way as real member properties.

Fixes #74.

Test Case

The issue screenshots include this representative Swift code:

@discardableResult
func printSummary(for jobs: [BuildJob]) -> Int {
    let completed = jobs.filter { $0.state == .finished }
    let grouped = Dictionary(grouping: jobs, by: \.state)
    return completed.count
}

Expected captures after this change:

for      -> @variable.parameter
jobs     -> @variable.parameter
grouping -> @label
by       -> @label
filter   -> @function.call

Before this change, for, jobs, grouping, and by were captured as @property.

Validation

  • Ran tree-sitter-cli query against the screenshot-derived Swift snippet and compared origin/main vs this branch.
  • Confirmed the captures changed from @property to @variable.parameter / @label for the issue cases.
  • Confirmed nearby jobs.filter remains captured as @function.call.
  • Ran cargo test.
  • Ran git diff --check.

@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented May 10, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @ollieatkinson on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@ollieatkinson
Copy link
Copy Markdown
Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed label May 10, 2026
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented May 10, 2026

The cla-bot has been summoned, and re-checked this pull request!

@ollieatkinson ollieatkinson marked this pull request as ready for review May 11, 2026 11:10
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.

Swift highlighting: parameter labels and argument labels are captured as property

1 participant