;;(identifier) @variable

;; Methods

(method_declaration name: (identifier) @identifier.function)
(local_function_statement name: (identifier) @identifier.function)

;; Types

(interface_declaration name: (identifier) @identifier.type)
(class_declaration name: (identifier) @identifier.type)
(enum_declaration name: (identifier) @identifier.type)
(struct_declaration (identifier) @identifier.type)
(record_declaration (identifier) @identifier.type)
(namespace_declaration name: (identifier) @identifier.type)

(generic_name (identifier) @identifier.type)
(type_parameter (identifier) @identifier.property.define)
(parameter type: (identifier) @identifier.type)
(type_argument_list (identifier) @identifier.type)
(as_expression right: (identifier) @identifier.type)
(is_expression right: (identifier) @identifier.type)

(constructor_declaration name: (identifier) @identifier.constructor)
(destructor_declaration name: (identifier) @identifier.constructor)

(_ type: (identifier) @identifier.type)

(base_list (identifier) @identifier.type)

(predefined_type) @identifier.type.builtin

;; Enum
(enum_member_declaration (identifier) @identifier.property.define)

;; Literals

[
  (real_literal)
  (integer_literal)
] @value.number

[
  (character_literal)
  (string_literal)
  (raw_string_literal)
  (verbatim_string_literal)
  (interpolated_string_expression)
  (interpolation_start)
  (interpolation_quote)
 ] @string

(escape_sequence) @string.escape

[
  (boolean_literal)
  (null_literal)
] @identifier.constant.builtin

;; Comments

(comment) @comment

;; Tokens

[
  ";"
  "."
  ","
] @punctuation.delimiter

[
  "--"
  "-"
  "-="
  "&"
  "&="
  "&&"
  "+"
  "++"
  "+="
  "<"
  "<="
  "<<"
  "<<="
  "="
  "=="
  "!"
  "!="
  "=>"
  ">"
  ">="
  ">>"
  ">>="
  ">>>"
  ">>>="
  "|"
  "|="
  "||"
  "?"
  "??"
  "??="
  "^"
  "^="
  "~"
  "*"
  "*="
  "/"
  "/="
  "%"
  "%="
  ":"
] @operator

[
  "("
  ")"
  "["
  "]"
  "{"
  "}"
  (interpolation_brace)
]  @punctuation.bracket

;; Keywords

[
  (implicit_type)
] @keyword

[
  "this"
  "base"
] @keyword.self

[
  "catch"
  "case"
  "checked"
  "do"
  "else"
  "if"
  "finally"
  "fixed"
  "for"
  "foreach"
  "lock"
  "switch"
  "try"
  "unchecked"
  "using"
  "while"
] @keyword.condition

[
  (modifier)
  "add"
  "as"
  "await"
  "delegate"
  "explicit"
  "extern"
  "from"
  "get"
  "global"
  "implicit"
  "in"
  "init"
  "is"
  "notnull"
  "out"
  "params"
  "ref"
  "remove"
  "select"
  "set"
  "stackalloc"
  "static"
  "when"
  "where"
  "with"
] @keyword.modifier

[
  "alias"
  "class"
  "enum"
  "event"
  "interface"
  "namespace"
  "operator"
  "record"
  "struct"
] @keyword.construct

[
  "break"
  "continue"
  "default"
  "goto"
  "return"
  "sizeof"
  "throw"
  "typeof"
  "new"
  "yield"
  "let"
] @keyword

;; Attribute

(attribute name: (identifier) @identifier.property)

;; Parameters

(parameter
  name: (identifier) @identifier.argument)

;; Type constraints

(type_parameter_constraints_clause (identifier) @identifier.property.define)

;; Method calls

(invocation_expression (member_access_expression name: (identifier) @identifier.function))
