Skip to content

Commit

Permalink
refactor!: use last-wins precedence for queries
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed Feb 16, 2024
1 parent 6b7ccc9 commit a70daac
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions queries/highlights.scm
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
; Identifiers

(type_identifier) @type
(primitive_type) @type.builtin
(field_identifier) @property

; Identifier conventions

; Assume all-caps names are constants
((identifier) @constant
(#match? @constant "^[A-Z][A-Z\\d_]+$'"))

; Assume uppercase names are enum constructors
((identifier) @constructor
(#match? @constructor "^[A-Z]"))

; Assume that uppercase names in paths are types
((scoped_identifier
path: (identifier) @type)
Expand All @@ -20,10 +30,6 @@
name: (identifier) @type))
(#match? @type "^[A-Z]"))

; Assume other uppercase names are enum constructors
((identifier) @constructor
(#match? @constructor "^[A-Z]"))

; Assume all qualified names in struct patterns are enum constructors. (They're
; either that, or struct names; highlighting both as constructors seems to be
; the less glaring choice of error, visually.)
Expand Down Expand Up @@ -61,12 +67,6 @@
(function_item (identifier) @function)
(function_signature_item (identifier) @function)

; Other identifiers

(type_identifier) @type
(primitive_type) @type.builtin
(field_identifier) @property

(line_comment) @comment
(block_comment) @comment

Expand Down

0 comments on commit a70daac

Please sign in to comment.