Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'runtime/queries/c-sharp/highlights.scm')
-rw-r--r--runtime/queries/c-sharp/highlights.scm168
1 files changed, 99 insertions, 69 deletions
diff --git a/runtime/queries/c-sharp/highlights.scm b/runtime/queries/c-sharp/highlights.scm
index 07c3bfc3..b76f4e60 100644
--- a/runtime/queries/c-sharp/highlights.scm
+++ b/runtime/queries/c-sharp/highlights.scm
@@ -1,64 +1,55 @@
-(identifier) @variable
-
;; Methods
-
-(method_declaration name: (identifier) @function)
-(local_function_statement name: (identifier) @function)
+(method_declaration (identifier) @type (identifier) @function)
;; Types
-
(interface_declaration name: (identifier) @type)
(class_declaration name: (identifier) @type)
(enum_declaration name: (identifier) @type)
(struct_declaration (identifier) @type)
(record_declaration (identifier) @type)
-(namespace_declaration name: (identifier) @namespace)
-
-(generic_name (identifier) @type)
-(type_parameter (identifier) @type.parameter)
-(parameter type: (identifier) @type)
-(type_argument_list (identifier) @type)
-(as_expression right: (identifier) @type)
-(is_expression right: (identifier) @type)
+(namespace_declaration name: (identifier) @type)
-(constructor_declaration name: (identifier) @constructor)
-(destructor_declaration name: (identifier) @constructor)
+(constructor_declaration name: (identifier) @type)
-(_ type: (identifier) @type)
-
-(base_list (identifier) @type)
-
-(predefined_type) @type.builtin
+[
+ (implicit_type)
+ (nullable_type)
+ (pointer_type)
+ (function_pointer_type)
+ (predefined_type)
+] @type.builtin
;; Enum
-(enum_member_declaration (identifier) @type.enum.variant)
+(enum_member_declaration (identifier) @variable.property)
;; Literals
-
-(real_literal) @constant.numeric.float
-(integer_literal) @constant.numeric.integer
-(character_literal) @constant.character
+[
+ (real_literal)
+ (integer_literal)
+] @number
[
+ (character_literal)
(string_literal)
- (raw_string_literal)
(verbatim_string_literal)
- (interpolated_string_expression)
- (interpolation_start)
- (interpolation_quote)
+ (interpolated_string_text)
+ (interpolated_verbatim_string_text)
+ "\""
+ "$\""
+ "@$\""
+ "$@\""
] @string
-(escape_sequence) @constant.character.escape
-
-(boolean_literal) @constant.builtin.boolean
-(null_literal) @constant.builtin
+[
+ (boolean_literal)
+ (null_literal)
+ (void_keyword)
+] @constant.builtin
;; Comments
-
(comment) @comment
;; Tokens
-
[
";"
"."
@@ -70,41 +61,28 @@
"-"
"-="
"&"
- "&="
"&&"
"+"
"++"
"+="
"<"
- "<="
"<<"
- "<<="
"="
"=="
"!"
"!="
"=>"
">"
- ">="
">>"
- ">>="
- ">>>"
- ">>>="
"|"
- "|="
"||"
"?"
"??"
- "??="
"^"
- "^="
"~"
"*"
- "*="
"/"
- "/="
"%"
- "%="
":"
] @operator
@@ -115,20 +93,14 @@
"]"
"{"
"}"
- (interpolation_brace)
] @punctuation.bracket
;; Keywords
+(modifier) @keyword
+(this_expression) @keyword
+(escape_sequence) @keyword
[
- (modifier)
- "this"
- (implicit_type)
-] @keyword
-
-[
- "add"
- "alias"
"as"
"base"
"break"
@@ -144,11 +116,9 @@
"enum"
"event"
"explicit"
- "extern"
"finally"
"for"
"foreach"
- "global"
"goto"
"if"
"implicit"
@@ -156,14 +126,11 @@
"is"
"lock"
"namespace"
- "notnull"
"operator"
"params"
"return"
- "remove"
"sizeof"
"stackalloc"
- "static"
"struct"
"switch"
"throw"
@@ -190,19 +157,82 @@
"let"
] @keyword
-;; Attribute
-(attribute name: (identifier) @attribute)
+;; Linq
+(from_clause (identifier) @variable)
+(group_clause)
+(order_by_clause)
+(select_clause (identifier) @variable)
+(query_continuation (identifier) @variable) @keyword
+
+;; Record
+(with_expression
+ (with_initializer_expression
+ (simple_assignment_expression
+ (identifier) @variable)))
+
+;; Exprs
+(binary_expression (identifier) @variable (identifier) @variable)
+(binary_expression (identifier)* @variable)
+(conditional_expression (identifier) @variable)
+(prefix_unary_expression (identifier) @variable)
+(postfix_unary_expression (identifier)* @variable)
+(assignment_expression (identifier) @variable)
+(cast_expression (identifier) @type (identifier) @variable)
+
+;; Class
+(base_list (identifier) @type)
+(property_declaration (generic_name))
+(property_declaration
+ type: (nullable_type) @type
+ name: (identifier) @variable)
+(property_declaration
+ type: (predefined_type) @type
+ name: (identifier) @variable)
+(property_declaration
+ type: (identifier) @type
+ name: (identifier) @variable)
+
+;; Lambda
+(lambda_expression) @variable
-;; Parameters
+;; Attribute
+(attribute) @type
+;; Parameter
(parameter
+ type: (identifier) @type
name: (identifier) @variable.parameter)
+(parameter (identifier) @variable.parameter)
+(parameter_modifier) @keyword
+
+;; Typeof
+(type_of_expression (identifier) @type)
+
+;; Variable
+(variable_declaration (identifier) @type)
+(variable_declarator (identifier) @variable)
+
+;; Return
+(return_statement (identifier) @variable)
+(yield_statement (identifier) @variable)
+
+;; Type
+(generic_name (identifier) @type)
+(type_parameter (identifier) @variable.parameter)
+(type_argument_list (identifier) @type)
;; Type constraints
+(type_parameter_constraints_clause (identifier) @variable.parameter)
+(type_constraint (identifier) @type)
-(type_parameter_constraints_clause (identifier) @type.parameter)
+;; Exception
+(catch_declaration (identifier) @type (identifier) @variable)
+(catch_declaration (identifier) @type)
-;; Method calls
+;; Switch
+(switch_statement (identifier) @variable)
+(switch_expression (identifier) @variable)
-(invocation_expression (member_access_expression name: (identifier) @function))
+;; Lock statement
+(lock_statement (identifier) @variable)