Skip to content

[FR] Specific class and pattern highlighting #29

Description

@bashful-strix

I've slowly added these highlight queries to my local overrides over time, and find them useful enough to suggest upstreaming:

(pat_name (variable) @variable.parameter)
(pat_field (field_name) @variable.parameter .)

(class_name (type) @attribute)
(class_import (type_name (type) @attribute))
; first type name after (optional) constraints is a class name
(derive_declaration (constraints)? . (type_name (type) @attribute))
; types before a '=>' operator are classes
((type_apply (type_name (type) @attribute)) . (type_operator) @operator
  (#eq? @operator "=>"))
((type_name (type) @attribute) . (type_operator) @operator
  (#eq? @operator "=>"))

Before:
Image

After:
Image

If you like them, I can raise a PR (definitely not an expert in queries if there's a better way to write them). Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions