Skip to content

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

@ollieatkinson

Description

@ollieatkinson

Zed’s Swift tree-sitter highlights currently classify Swift labels as property, so themes cannot distinguish them from real member properties.

func printSummary(for jobs: [BuildJob]) -> Int
//                ^^^ external parameter label should not be property

Current behaviour:

  • External/internal function parameter names can be captured as property.
  • User config cannot cleanly fix this without also changing the highlighting of real properties.

Expected:

  • Parameter names should probably be variable.parameter.
  • Argument labels should probably be label, variable.parameter, or another non-property capture.
  • Real properties like jobs.count, job.id should remain property.

Potential fix area (need help):

(parameter external_name: (simple_identifier) @variable.parameter)
(parameter name: (simple_identifier) @variable.parameter)
(value_argument name: (value_argument_label) @label)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions