Skip to content

Commit

Permalink
highlighting: Revamp ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
obiwac committed Sep 10, 2024
1 parent 63e9403 commit effcb97
Showing 1 changed file with 40 additions and 34 deletions.
74 changes: 40 additions & 34 deletions queries/highlights.scm
Original file line number Diff line number Diff line change
@@ -1,44 +1,28 @@
; This Source Form is subject to the terms of the AQUA Software License,
; v. 1.0. Copyright (c) 2024 Aymeric Wibo

; The order of these captures is important; the last match is the one that is used.
; So start off with all the matches on primitive constructs, and then do the more complex stuff after.

; Comments.

(comment) @comment
(doc_comment) @comment.documentation

; function calls

(call
callable: (expression (identifier)) @function
)

; builtins

[
"print"
"assert"
] @function.builtin

; identifiers
; Identifiers.

(identifier) @variable

; operators

(overloadable_operator) @operator
; Literals.

; declarations
(string) @string
(number) @number
(bool) @constant.builtin
(none) @constant.builtin

(var_decl name: (identifier) type: (type) @variable)
(function_declaration name:
[
(identifier)
(overloadable_operator)
] @function
)
(class_declaration name: (identifier) @class)
; Operators.

; operators
(overloadable_operator) @operator

[
"**"
Expand All @@ -58,7 +42,7 @@
"^^"
] @operator

; keywords
; Keywords.

[
"extern"
Expand All @@ -67,9 +51,17 @@
"class"
"import"
"return"
"let"
] @keyword

; types
; Builtins.

[
"print"
"assert"
] @function.builtin

; Types.

(type_name) @type
[
Expand All @@ -78,9 +70,23 @@
"map"
] @type.builtin

; literals
; Function calls.

(string) @string
(number) @number
(bool) @constant.builtin
(none) @constant.builtin
(call
callable: (expression (identifier) @function.method)
)

(call
callable: (expression (access accessor: (identifier) @function.method))
)

; Declarations.

(var_decl name: (identifier) type: (type) @variable)
(function_declaration name:
[
(identifier)
(overloadable_operator)
] @function
)
(class_declaration name: (identifier) @function)

0 comments on commit effcb97

Please sign in to comment.