2021-10-17 06:45:09 +02:00
|
|
|
;; Methods
|
2022-03-12 19:06:56 +01:00
|
|
|
(method_declaration
|
|
|
|
name: (identifier) @function)
|
|
|
|
|
|
|
|
(method_declaration
|
|
|
|
type: [(identifier) (qualified_name)] @type)
|
|
|
|
|
|
|
|
(invocation_expression
|
|
|
|
(member_access_expression
|
|
|
|
name: (identifier) @function))
|
|
|
|
|
|
|
|
(invocation_expression
|
|
|
|
(member_access_expression
|
|
|
|
expression: (identifier) @variable))
|
|
|
|
|
|
|
|
(invocation_expression
|
|
|
|
function: (conditional_access_expression
|
|
|
|
(member_binding_expression
|
|
|
|
name: (identifier) @function)))
|
|
|
|
|
|
|
|
(invocation_expression
|
|
|
|
[(identifier) (qualified_name)] @function)
|
|
|
|
|
|
|
|
; Generic Method invocation with generic type
|
|
|
|
(invocation_expression
|
|
|
|
function: (generic_name
|
|
|
|
. (identifier) @function))
|
|
|
|
|
|
|
|
;; Namespaces
|
|
|
|
|
|
|
|
(namespace_declaration
|
|
|
|
name: [(identifier) (qualified_name)] @namespace)
|
2021-10-17 06:45:09 +02:00
|
|
|
|
|
|
|
;; 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) @type)
|
2022-03-12 19:06:56 +01:00
|
|
|
(using_directive (_) @namespace)
|
2021-10-17 06:45:09 +02:00
|
|
|
(constructor_declaration name: (identifier) @type)
|
2022-03-12 19:06:56 +01:00
|
|
|
(object_creation_expression [(identifier) (qualified_name)] @type)
|
|
|
|
(type_parameter_list (type_parameter) @type)
|
2021-10-17 06:45:09 +02:00
|
|
|
|
|
|
|
[
|
|
|
|
(implicit_type)
|
|
|
|
(nullable_type)
|
|
|
|
(pointer_type)
|
|
|
|
(function_pointer_type)
|
|
|
|
(predefined_type)
|
|
|
|
] @type.builtin
|
|
|
|
|
2022-03-12 19:06:56 +01:00
|
|
|
;; Generic Types
|
|
|
|
(type_of_expression
|
|
|
|
(generic_name
|
|
|
|
(identifier) @type))
|
|
|
|
|
|
|
|
(base_list
|
|
|
|
(generic_name
|
|
|
|
(identifier) @type))
|
|
|
|
|
|
|
|
(type_constraint
|
|
|
|
(generic_name
|
|
|
|
(identifier) @type))
|
|
|
|
|
|
|
|
(object_creation_expression
|
|
|
|
(generic_name
|
|
|
|
(identifier) @type))
|
|
|
|
|
|
|
|
(property_declaration
|
|
|
|
(generic_name
|
|
|
|
(identifier) @type))
|
|
|
|
|
|
|
|
(_
|
|
|
|
type: (generic_name
|
|
|
|
(identifier) @type))
|
|
|
|
|
2021-10-17 06:45:09 +02:00
|
|
|
;; Enum
|
2021-11-03 04:00:52 +01:00
|
|
|
(enum_member_declaration (identifier) @variable.other.member)
|
2021-10-17 06:45:09 +02:00
|
|
|
|
|
|
|
;; Literals
|
|
|
|
[
|
|
|
|
(real_literal)
|
|
|
|
(integer_literal)
|
2021-11-03 04:00:52 +01:00
|
|
|
] @constant.numeric.integer
|
2021-10-17 06:45:09 +02:00
|
|
|
|
2021-11-03 04:00:52 +01:00
|
|
|
(character_literal) @constant.character
|
2021-10-17 06:45:09 +02:00
|
|
|
[
|
|
|
|
(string_literal)
|
|
|
|
(verbatim_string_literal)
|
|
|
|
(interpolated_string_text)
|
|
|
|
(interpolated_verbatim_string_text)
|
|
|
|
"\""
|
|
|
|
"$\""
|
|
|
|
"@$\""
|
|
|
|
"$@\""
|
|
|
|
] @string
|
|
|
|
|
2021-11-03 04:00:52 +01:00
|
|
|
(boolean_literal) @constant.builtin.boolean
|
2021-10-17 06:45:09 +02:00
|
|
|
[
|
|
|
|
(null_literal)
|
|
|
|
(void_keyword)
|
|
|
|
] @constant.builtin
|
|
|
|
|
|
|
|
;; Comments
|
|
|
|
(comment) @comment
|
|
|
|
|
|
|
|
;; Tokens
|
|
|
|
[
|
|
|
|
";"
|
|
|
|
"."
|
|
|
|
","
|
|
|
|
] @punctuation.delimiter
|
|
|
|
|
|
|
|
[
|
|
|
|
"--"
|
|
|
|
"-"
|
|
|
|
"-="
|
|
|
|
"&"
|
|
|
|
"&&"
|
|
|
|
"+"
|
|
|
|
"++"
|
|
|
|
"+="
|
|
|
|
"<"
|
2022-03-12 19:06:56 +01:00
|
|
|
"<="
|
2021-10-17 06:45:09 +02:00
|
|
|
"<<"
|
2022-03-12 19:06:56 +01:00
|
|
|
"<<="
|
2021-10-17 06:45:09 +02:00
|
|
|
"="
|
|
|
|
"=="
|
|
|
|
"!"
|
|
|
|
"!="
|
|
|
|
"=>"
|
|
|
|
">"
|
2022-03-12 19:06:56 +01:00
|
|
|
">="
|
2021-10-17 06:45:09 +02:00
|
|
|
">>"
|
2022-03-12 19:06:56 +01:00
|
|
|
">>="
|
2021-10-17 06:45:09 +02:00
|
|
|
"|"
|
|
|
|
"||"
|
2022-03-12 19:06:56 +01:00
|
|
|
"|="
|
2021-10-17 06:45:09 +02:00
|
|
|
"?"
|
|
|
|
"??"
|
|
|
|
"^"
|
2022-03-12 19:06:56 +01:00
|
|
|
"^="
|
2021-10-17 06:45:09 +02:00
|
|
|
"~"
|
|
|
|
"*"
|
2022-03-12 19:06:56 +01:00
|
|
|
"*="
|
2021-10-17 06:45:09 +02:00
|
|
|
"/"
|
2022-03-12 19:06:56 +01:00
|
|
|
"/="
|
2021-10-17 06:45:09 +02:00
|
|
|
"%"
|
2022-03-12 19:06:56 +01:00
|
|
|
"%="
|
2021-10-17 06:45:09 +02:00
|
|
|
":"
|
2022-03-12 19:06:56 +01:00
|
|
|
".."
|
|
|
|
"&="
|
|
|
|
"->"
|
|
|
|
"??="
|
2021-10-17 06:45:09 +02:00
|
|
|
] @operator
|
|
|
|
|
|
|
|
[
|
|
|
|
"("
|
|
|
|
")"
|
|
|
|
"["
|
|
|
|
"]"
|
|
|
|
"{"
|
|
|
|
"}"
|
|
|
|
] @punctuation.bracket
|
|
|
|
|
|
|
|
;; Keywords
|
|
|
|
(modifier) @keyword
|
|
|
|
(this_expression) @keyword
|
2021-11-03 04:00:52 +01:00
|
|
|
(escape_sequence) @constant.character.escape
|
2021-10-17 06:45:09 +02:00
|
|
|
|
|
|
|
[
|
|
|
|
"as"
|
|
|
|
"base"
|
|
|
|
"break"
|
|
|
|
"case"
|
|
|
|
"catch"
|
|
|
|
"checked"
|
|
|
|
"class"
|
|
|
|
"continue"
|
|
|
|
"default"
|
|
|
|
"delegate"
|
|
|
|
"do"
|
|
|
|
"else"
|
|
|
|
"enum"
|
|
|
|
"event"
|
|
|
|
"explicit"
|
|
|
|
"finally"
|
|
|
|
"for"
|
|
|
|
"foreach"
|
|
|
|
"goto"
|
|
|
|
"if"
|
|
|
|
"implicit"
|
|
|
|
"interface"
|
|
|
|
"is"
|
|
|
|
"lock"
|
|
|
|
"namespace"
|
|
|
|
"operator"
|
|
|
|
"params"
|
|
|
|
"return"
|
|
|
|
"sizeof"
|
|
|
|
"stackalloc"
|
2022-03-12 19:06:56 +01:00
|
|
|
"static"
|
2021-10-17 06:45:09 +02:00
|
|
|
"struct"
|
|
|
|
"switch"
|
|
|
|
"throw"
|
|
|
|
"try"
|
|
|
|
"typeof"
|
|
|
|
"unchecked"
|
|
|
|
"using"
|
|
|
|
"while"
|
|
|
|
"new"
|
|
|
|
"await"
|
|
|
|
"in"
|
|
|
|
"yield"
|
|
|
|
"get"
|
|
|
|
"set"
|
|
|
|
"when"
|
|
|
|
"out"
|
|
|
|
"ref"
|
|
|
|
"from"
|
|
|
|
"where"
|
|
|
|
"select"
|
|
|
|
"record"
|
|
|
|
"init"
|
|
|
|
"with"
|
|
|
|
"let"
|
|
|
|
] @keyword
|
|
|
|
|
2022-03-12 19:06:56 +01:00
|
|
|
(preprocessor_call) @keyword.directive
|
|
|
|
(preprocessor_call (_) @keyword.directive)
|
2021-10-17 06:45:09 +02:00
|
|
|
|
|
|
|
;; 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
|
2022-03-12 19:06:56 +01:00
|
|
|
(binary_expression [(identifier) (qualified_name)] @variable [(identifier) (qualified_name)] @variable)
|
|
|
|
(binary_expression [(identifier) (qualified_name)]* @variable)
|
|
|
|
(conditional_expression [(identifier) (qualified_name)] @variable)
|
|
|
|
(prefix_unary_expression [(identifier) (qualified_name)] @variable)
|
|
|
|
(postfix_unary_expression [(identifier) (qualified_name)]* @variable)
|
|
|
|
(assignment_expression [(identifier) (qualified_name)] @variable)
|
|
|
|
(cast_expression [(identifier) (qualified_name)] @type [(identifier) (qualified_name)] @variable)
|
2021-10-17 06:45:09 +02:00
|
|
|
|
|
|
|
;; 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)
|
2022-03-12 19:06:56 +01:00
|
|
|
|
|
|
|
;; Delegate
|
|
|
|
|
|
|
|
(delegate_declaration (identifier) @type)
|
2021-10-17 06:45:09 +02:00
|
|
|
|
|
|
|
;; Lambda
|
|
|
|
(lambda_expression) @variable
|
|
|
|
|
|
|
|
;; Attribute
|
|
|
|
(attribute) @type
|
|
|
|
|
|
|
|
;; Parameter
|
|
|
|
(parameter
|
|
|
|
type: (identifier) @type
|
|
|
|
name: (identifier) @variable.parameter)
|
|
|
|
(parameter (identifier) @variable.parameter)
|
|
|
|
(parameter_modifier) @keyword
|
|
|
|
|
2022-03-12 19:06:56 +01:00
|
|
|
(parameter_list
|
|
|
|
(parameter
|
|
|
|
name: (identifier) @parameter))
|
|
|
|
|
|
|
|
(parameter_list
|
|
|
|
(parameter
|
|
|
|
type: [(identifier) (qualified_name)] @type))
|
|
|
|
|
2021-10-17 06:45:09 +02:00
|
|
|
;; Typeof
|
2022-03-12 19:06:56 +01:00
|
|
|
(type_of_expression [(identifier) (qualified_name)] @type)
|
2021-10-17 06:45:09 +02:00
|
|
|
|
|
|
|
;; Variable
|
2022-03-12 19:06:56 +01:00
|
|
|
(variable_declaration [(identifier) (qualified_name)] @type)
|
|
|
|
(variable_declarator [(identifier) (qualified_name)] @variable)
|
2021-10-17 06:45:09 +02:00
|
|
|
|
|
|
|
;; Return
|
|
|
|
(return_statement (identifier) @variable)
|
|
|
|
(yield_statement (identifier) @variable)
|
|
|
|
|
|
|
|
;; Type
|
|
|
|
(generic_name (identifier) @type)
|
2022-03-12 19:06:56 +01:00
|
|
|
(type_parameter [(identifier) (qualified_name)] @variable.parameter)
|
|
|
|
(type_argument_list [(identifier) (qualified_name)] @type)
|
2021-10-17 06:45:09 +02:00
|
|
|
|
|
|
|
;; Type constraints
|
|
|
|
(type_parameter_constraints_clause (identifier) @variable.parameter)
|
|
|
|
(type_constraint (identifier) @type)
|
|
|
|
|
|
|
|
;; Exception
|
|
|
|
(catch_declaration (identifier) @type (identifier) @variable)
|
|
|
|
(catch_declaration (identifier) @type)
|
|
|
|
|
|
|
|
;; Switch
|
|
|
|
(switch_statement (identifier) @variable)
|
|
|
|
(switch_expression (identifier) @variable)
|
|
|
|
|
|
|
|
;; Lock statement
|
|
|
|
(lock_statement (identifier) @variable)
|
2022-03-12 19:06:56 +01:00
|
|
|
|
|
|
|
;; Rest
|
|
|
|
(member_access_expression) @variable
|
|
|
|
(element_access_expression (identifier) @variable)
|
|
|
|
(argument (identifier) @variable)
|
|
|
|
(for_statement (identifier) @variable)
|
|
|
|
(for_each_statement (identifier) @variable)
|
|
|
|
(expression_statement (identifier) @variable)
|
|
|
|
(member_access_expression expression: (identifier) @variable)
|
|
|
|
(member_access_expression name: (identifier) @variable)
|
|
|
|
(conditional_access_expression [(identifier) (qualified_name)] @variable)
|
|
|
|
((identifier) @comment.unused
|
|
|
|
(#eq? @comment.unused "_"))
|