@@ -3,15 +3,13 @@
4 (integer) @constant.numeric.integer
4 (integer) @constant.numeric.integer
5 (exp_negation) @constant.numeric.integer
5 (exp_negation) @constant.numeric.integer
6− (exp_literal (float)) @constant.numeric.float
6+ (exp_literal (number)) @constant.numeric.float
7 (char) @constant.character
7 (char) @constant.character
10 (triple_quote_string)
10 (triple_quote_string)
13− (con_unit) @constant.builtin ; unit, as in ()
15 (comment) @comment
13 (comment) @comment
@@ -36,6 +34,10 @@
36; ----------------------------------------------------------------------------
34; ----------------------------------------------------------------------------
37; Keywords, operators, includes
35; Keywords, operators, includes
37+ ; This needs to come before the other "else" in
38+ ; order to be highlighted correctly
39+ (class_instance "else" @keyword)
@@ -53,15 +55,20 @@
53 (operator)
55 (operator)
54 (constructor_operator)
56 (constructor_operator)
55 (type_operator)
57 (type_operator)
57 (qualified_module) ; grabs the `.` (dot), ex: import System.IO
58 (qualified_module) ; grabs the `.` (dot), ex: import System.IO
58 (all_names)
59 (all_names)
61+ ; `_` wildcards in if-then-else and case-of expressions,
62+ ; as well as record updates and operator sections
@@ -89,6 +96,7 @@
@@ -98,24 +106,40 @@
99 ] @keyword
107 ] @keyword
109+ (type_role_declaration
111+ role: (type_role) @keyword)
102; ----------------------------------------------------------------------------
115; ----------------------------------------------------------------------------
103; Functions and variables
116; Functions and variables
118+ (row_field (field_name) @variable.other.member)
119+ (record_field (field_name) @variable.other.member)
120+ (record_accessor (variable) @variable.other.member)
121+ (exp_record_access (variable) @variable.other.member)
105 (signature name: (variable) @type)
123 (signature name: (variable) @type)
106 (function name: (variable) @function)
124 (function name: (variable) @function)
125+ (class_instance (instance_name) @function)
126+ (derive_declaration (instance_name) @function)
108 ; true or false
128 ; true or false
109((variable) @constant.builtin.boolean
129((variable) @constant.builtin.boolean
110 (#match? @constant.builtin.boolean "^(true|false)$"))
130 (#match? @constant.builtin.boolean "^(true|false)$"))
112− (variable) @variable
132+ ; The former one works for `tree-sitter highlight` but not in Helix/Kakoune.
133+ ; The latter two work in Helix (but not Kakoune) and are a good compromise between not highlighting anything at all
134+ ; as an operator and leaving it to the child nodes, and highlighting everything as an operator.
135+ (exp_ticked (_) @operator)
136+ (exp_ticked (exp_name (variable) @operator))
137+ (exp_ticked (exp_name (qualified_variable (variable) @operator)))
114− (exp_infix (variable) @operator) ; consider infix functions as operators
139+ (variable) @variable
116 ("@" @namespace) ; "as" pattern operator, e.g. x@Constructor
141 ("@" @namespace) ; "as" pattern operator, e.g. x@Constructor
119; ----------------------------------------------------------------------------
143; ----------------------------------------------------------------------------