diff --git a/queries/highlights.scm b/queries/highlights.scm index 528db25..d88398a 100644 --- a/queries/highlights.scm +++ b/queries/highlights.scm @@ -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) @@ -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.) @@ -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