Skip to content

Commit a70daac

Browse files
committed
refactor!: use last-wins precedence for queries
1 parent 6b7ccc9 commit a70daac

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

queries/highlights.scm

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1+
; Identifiers
2+
3+
(type_identifier) @type
4+
(primitive_type) @type.builtin
5+
(field_identifier) @property
6+
17
; Identifier conventions
28

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

13+
; Assume uppercase names are enum constructors
14+
((identifier) @constructor
15+
(#match? @constructor "^[A-Z]"))
16+
717
; Assume that uppercase names in paths are types
818
((scoped_identifier
919
path: (identifier) @type)
@@ -20,10 +30,6 @@
2030
name: (identifier) @type))
2131
(#match? @type "^[A-Z]"))
2232

23-
; Assume other uppercase names are enum constructors
24-
((identifier) @constructor
25-
(#match? @constructor "^[A-Z]"))
26-
2733
; Assume all qualified names in struct patterns are enum constructors. (They're
2834
; either that, or struct names; highlighting both as constructors seems to be
2935
; the less glaring choice of error, visually.)
@@ -61,12 +67,6 @@
6167
(function_item (identifier) @function)
6268
(function_signature_item (identifier) @function)
6369

64-
; Other identifiers
65-
66-
(type_identifier) @type
67-
(primitive_type) @type.builtin
68-
(field_identifier) @property
69-
7070
(line_comment) @comment
7171
(block_comment) @comment
7272

0 commit comments

Comments
 (0)