|
3 | 3 |
|
4 | 4 | (integer) @constant.numeric.integer |
5 | 5 | (exp_negation) @constant.numeric.integer |
6 | | - (exp_literal (float)) @constant.numeric.float |
| 6 | + (exp_literal (number)) @constant.numeric.float |
7 | 7 | (char) @constant.character |
8 | 8 | [ |
9 | 9 | (string) |
10 | 10 | (triple_quote_string) |
11 | 11 | ] @string |
12 | 12 |
|
13 | | - (con_unit) @constant.builtin ; unit, as in () |
14 | | - |
15 | 13 | (comment) @comment |
16 | 14 |
|
17 | 15 |
|
|
36 | 34 | ; ---------------------------------------------------------------------------- |
37 | 35 | ; Keywords, operators, includes |
38 | 36 |
|
| 37 | + ; This needs to come before the other "else" in |
| 38 | + ; order to be highlighted correctly |
| 39 | + (class_instance "else" @keyword) |
| 40 | + |
39 | 41 | [ |
40 | 42 | "if" |
41 | 43 | "then" |
|
53 | 55 | (operator) |
54 | 56 | (constructor_operator) |
55 | 57 | (type_operator) |
56 | | - (tycon_arrow) |
57 | 58 | (qualified_module) ; grabs the `.` (dot), ex: import System.IO |
58 | 59 | (all_names) |
| 60 | + |
| 61 | + ; `_` wildcards in if-then-else and case-of expressions, |
| 62 | + ; as well as record updates and operator sections |
| 63 | + (wildcard) |
59 | 64 | "=" |
60 | 65 | "|" |
61 | 66 | "::" |
62 | 67 | "∷" |
63 | 68 | "=>" |
64 | 69 | "⇒" |
| 70 | + "<=" |
| 71 | + "⇐" |
65 | 72 | "->" |
66 | 73 | "→" |
67 | 74 | "<-" |
|
89 | 96 | "newtype" |
90 | 97 | "type" |
91 | 98 | "as" |
| 99 | + "hiding" |
92 | 100 | "do" |
93 | 101 | "ado" |
94 | 102 | "forall" |
|
98 | 106 | "infixr" |
99 | 107 | ] @keyword |
100 | 108 |
|
| 109 | + (type_role_declaration |
| 110 | + "role" @keyword |
| 111 | + role: (type_role) @keyword) |
| 112 | + |
| 113 | + (hole) @label |
101 | 114 |
|
102 | 115 | ; ---------------------------------------------------------------------------- |
103 | 116 | ; Functions and variables |
104 | 117 |
|
| 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) |
| 122 | + |
105 | 123 | (signature name: (variable) @type) |
106 | 124 | (function name: (variable) @function) |
| 125 | + (class_instance (instance_name) @function) |
| 126 | + (derive_declaration (instance_name) @function) |
107 | 127 |
|
108 | 128 | ; true or false |
109 | 129 | ((variable) @constant.builtin.boolean |
110 | 130 | (#match? @constant.builtin.boolean "^(true|false)$")) |
111 | 131 |
|
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))) |
113 | 138 |
|
114 | | - (exp_infix (variable) @operator) ; consider infix functions as operators |
| 139 | + (variable) @variable |
115 | 140 |
|
116 | 141 | ("@" @namespace) ; "as" pattern operator, e.g. x@Constructor |
117 | 142 |
|
118 | | - |
119 | 143 | ; ---------------------------------------------------------------------------- |
120 | 144 | ; Types |
121 | 145 |
|
|
0 commit comments