; Types

(class_declaration
  name: (identifier) @name
  body: (_)
  (#set! role class)) @subtree

(struct_declaration
  name: (identifier) @name
  body: (_)
  (#set! role struct)) @subtree

(enum_declaration
  name: (identifier) @name
  body: (_)
  (#set! role enum)) @subtree

(interface_declaration
  name: (identifier) @name
  body: (_)
  (#set! role interface)) @subtree

(namespace_declaration
  name: (identifier) @name
  body: (_)
  (#set! role type)) @subtree

(record_declaration
  name: (identifier) @name
  (#set! role type)) @subtree

(extern_alias_directive
  name: (identifier) @name
  (#set! role type)) @subtree

; Properties

(field_declaration
  (variable_declaration
    (variable_declarator
      name: (identifier) @name))
      (#set! role property)) @subtree

; Functions

(local_function_statement
  name: (identifier) @name
  (#set! role function)) @subtree

(constructor_declaration
  name: (identifier) @name
  (#set! role constructor)) @subtree

(method_declaration
  name: (identifier) @name
  (#set! role method)) @subtree
