Unnamed repository; edit this file 'description' to name the repository.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
; Scopes

[
  (method_declaration)
  (creation_method_declaration)
  (constructor_declaration)
  (destructor_declaration)
  (local_function_declaration)
  (lambda_expression)
  (block)
  (for_statement)
  (foreach_statement)
] @local.scope

; Definitions

(parameter
  (identifier) @local.definition.variable.parameter)

(lambda_expression
  (identifier) @local.definition.variable.parameter)

; `foreach (Type x in ...)` — the identifier after the element type.
(foreach_statement
  .
  (type)
  .
  (identifier) @local.definition.variable)

; `Type x = ...;` — first identifier of each assignment in a local declaration.
(local_declaration
  (assignment
    .
    (identifier) @local.definition.variable))

; References

(identifier) @local.reference

; In `a.b`, `b` is a member access rather than a variable reference. A bare name
; is a single-child member_access_expression, so only discard the trailing
; identifier when it follows a receiver expression.
(member_access_expression
  (_)
  .
  (identifier) @_)