highlights.scm

  1;; Methods
  2(method_declaration name: (identifier) @function)
  3(local_function_statement name: (identifier) @function)
  4
  5;; Types
  6(interface_declaration name: (identifier) @type)
  7(class_declaration name: (identifier) @type)
  8(enum_declaration name: (identifier) @type)
  9(struct_declaration (identifier) @type)
 10(record_declaration (identifier) @type)
 11(record_struct_declaration (identifier) @type)
 12(namespace_declaration name: (identifier) @type)
 13
 14(constructor_declaration name: (identifier) @constructor)
 15(destructor_declaration name: (identifier) @constructor)
 16
 17[
 18  (implicit_type)
 19  (predefined_type)
 20] @type.builtin
 21
 22(_ type: (identifier) @type)
 23
 24;; Enum
 25(enum_member_declaration (identifier) @property)
 26
 27;; Literals
 28[
 29  (real_literal)
 30  (integer_literal)
 31] @number
 32
 33[
 34  (character_literal)
 35  (string_literal)
 36  (verbatim_string_literal)
 37  (interpolated_string_text)
 38  (interpolated_verbatim_string_text)
 39  "\""
 40  "$\""
 41  "@$\""
 42  "$@\""
 43 ] @string
 44
 45[
 46  (boolean_literal)
 47  (null_literal)
 48] @constant
 49
 50;; Comments
 51(comment) @comment
 52
 53;; Tokens
 54[
 55  ";"
 56  "."
 57  ","
 58] @punctuation.delimiter
 59
 60[
 61  "--"
 62  "-"
 63  "-="
 64  "&"
 65  "&="
 66  "&&"
 67  "+"
 68  "++"
 69  "+="
 70  "<"
 71  "<="
 72  "<<"
 73  "<<="
 74  "="
 75  "=="
 76  "!"
 77  "!="
 78  "=>"
 79  ">"
 80  ">="
 81  ">>"
 82  ">>="
 83  ">>>"
 84  ">>>="
 85  "|"
 86  "|="
 87  "||"
 88  "?"
 89  "??"
 90  "??="
 91  "^"
 92  "^="
 93  "~"
 94  "*"
 95  "*="
 96  "/"
 97  "/="
 98  "%"
 99  "%="
100  ":"
101] @operator
102
103[
104  "("
105  ")"
106  "["
107  "]"
108  "{"
109  "}"
110]  @punctuation.bracket
111
112;; Keywords
113(modifier) @keyword
114(this_expression) @keyword
115(escape_sequence) @keyword
116
117[
118  "add"
119  "alias"
120  "as"
121  "base"
122  "break"
123  "case"
124  "catch"
125  "checked"
126  "class"
127  "continue"
128  "default"
129  "delegate"
130  "do"
131  "else"
132  "enum"
133  "event"
134  "explicit"
135  "extern"
136  "finally"
137  "for"
138  "foreach"
139  "global"
140  "goto"
141  "if"
142  "implicit"
143  "interface"
144  "is"
145  "lock"
146  "namespace"
147  "notnull"
148  "operator"
149  "params"
150  "return"
151  "remove"
152  "sizeof"
153  "stackalloc"
154  "static"
155  "struct"
156  "switch"
157  "throw"
158  "try"
159  "typeof"
160  "unchecked"
161  "using"
162  "while"
163  "new"
164  "await"
165  "in"
166  "yield"
167  "get"
168  "set"
169  "when"
170  "out"
171  "ref"
172  "from"
173  "where"
174  "select"
175  "record"
176  "init"
177  "with"
178  "let"
179] @keyword
180
181
182;; Linq
183(from_clause (identifier) @variable)
184(group_clause (identifier) @variable)
185(order_by_clause (identifier) @variable)
186(join_clause (identifier) @variable)
187(select_clause (identifier) @variable)
188(query_continuation (identifier) @variable) @keyword
189
190;; Record
191(with_expression
192  (with_initializer_expression
193    (simple_assignment_expression
194      (identifier) @variable)))
195
196;; Exprs
197(binary_expression (identifier) @variable (identifier) @variable)
198(binary_expression (identifier)* @variable)
199(conditional_expression (identifier) @variable)
200(prefix_unary_expression (identifier) @variable)
201(postfix_unary_expression (identifier)* @variable)
202(assignment_expression (identifier) @variable)
203(cast_expression (_) (identifier) @variable)
204
205;; Class
206(base_list (identifier) @type) ;; applies to record_base too
207(property_declaration (generic_name))
208(property_declaration
209  name: (identifier) @variable)
210(property_declaration
211  name: (identifier) @variable)
212(property_declaration
213  name: (identifier) @variable)
214
215;; Lambda
216(lambda_expression) @variable
217
218;; Attribute
219(attribute) @attribute
220
221;; Parameter
222(parameter
223  name: (identifier) @variable)
224(parameter (identifier) @variable)
225(parameter_modifier) @keyword
226
227;; Variable declarations
228(variable_declarator (identifier) @variable)
229(for_each_statement left: (identifier) @variable)
230(catch_declaration (_) (identifier) @variable)
231
232;; Return
233(return_statement (identifier) @variable)
234(yield_statement (identifier) @variable)
235
236;; Type
237(generic_name (identifier) @type)
238(type_parameter (identifier) @property)
239(type_argument_list (identifier) @type)
240(as_expression right: (identifier) @type)
241(is_expression right: (identifier) @type)
242
243;; Type constraints
244(type_parameter_constraints_clause (identifier) @property)
245
246;; Switch
247(switch_statement (identifier) @variable)
248(switch_expression (identifier) @variable)
249
250;; Lock statement
251(lock_statement (identifier) @variable)
252
253;; Method calls
254(invocation_expression (member_access_expression name: (identifier) @function))