summaryrefslogtreecommitdiff
path: root/runtime/queries/ruby/textobjects.scm
blob: 34888c17d571c7fe0fde51ec39f8c05d8943017a (plain) (blame)
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
; Class
(class) @class.around

(class [(constant) (scope_resolution)] !superclass
  (_)+ @class.inside) 

(class [(constant) (scope_resolution)] (superclass)
  (_)+ @class.inside) 

(singleton_class
  value: (_)
  (_)+ @class.inside) @class.around

(call
  receiver: (constant) @class_const
  method: (identifier) @class_method
  (#match? @class_const "Class")
  (#match? @class_method "new")
  (do_block (_)+ @class.inside)) @class.around

; Functions
(method) @function.around

(method (identifier) (method_parameters)
  (_)+ @function.inside)
  
(do_block !parameters
  (_)+ @function.inside)
  
(do_block (block_parameters)
  (_)+ @function.inside)
    
(block (block_parameters)
  (_)+ @function.inside)
      
(block !parameters
  (_)+ @function.inside)
      
(method (identifier) !parameters
  (_)+  @function.inside)

; Parameters      
(method_parameters
  (_) @parameter.inside)
        
(block_parameters 
  (_) @parameter.inside)
        
(lambda_parameters 
  (_) @parameter.inside)

; Comments
(comment) @comment.inside 
(comment)+ @comment.around