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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
; -----------
; Definitions
; -----------

; Constants
(const_statement
  (assignment
    . (identifier) @local.definition.constant))

; Parameters (now in the signature's argument_list)
(argument_list
  (identifier) @local.definition.variable.parameter)

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

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

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

; Single parameter arrow function
(arrow_function_expression
  .
  (identifier) @local.definition.variable.parameter)

; ----------
; References
; ----------

(identifier) @local.reference

; A call's function name, field member access, and keyword-argument names are
; not variable references; cancel resolution so they keep their highlights.scm
; class even when a same-named local is in scope.
(call_expression
  . (identifier) @_)
(field_expression
  (_)
  (identifier) @_)
(call_expression
  (argument_list
    (assignment
      . (identifier) @_)))

; ------
; Scopes
; ------

[
  (for_statement)
  (while_statement)
  (try_statement)
  (catch_clause)
  (finally_clause)
  (let_statement)
  (quote_statement)
  (do_clause)
  (function_definition)
  (macro_definition)
] @local.scope