diff options
author | Danillo Melo | 2022-11-08 01:43:00 +0000 |
---|---|---|
committer | GitHub | 2022-11-08 01:43:00 +0000 |
commit | 188aff059bf9558b4fa28b03d5929020ff76cdb3 (patch) | |
tree | be9b413b707a9d8704acf5348eb9050614b7bf6b /runtime | |
parent | 535cf90093573d86af6e5510c90aee476703fed7 (diff) |
Improve Ruby TextObjects (#4601)
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/queries/ruby/textobjects.scm | 50 |
1 files changed, 20 insertions, 30 deletions
diff --git a/runtime/queries/ruby/textobjects.scm b/runtime/queries/ruby/textobjects.scm index 34888c17..2d48fa6f 100644 --- a/runtime/queries/ruby/textobjects.scm +++ b/runtime/queries/ruby/textobjects.scm @@ -1,11 +1,6 @@ -; Class -(class) @class.around - -(class [(constant) (scope_resolution)] !superclass - (_)+ @class.inside) - -(class [(constant) (scope_resolution)] (superclass) - (_)+ @class.inside) +; Class and Modules +(class + body: (_)? @class.inside) @class.around (singleton_class value: (_) @@ -17,37 +12,32 @@ (#match? @class_const "Class") (#match? @class_method "new") (do_block (_)+ @class.inside)) @class.around + +(module + body: (_)? @class.inside) @class.around -; Functions -(method) @function.around +; Functions and Blocks +(singleton_method + body: (_)? @function.inside) @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) +(method + body: (_)? @function.inside) @function.around + +(do_block + body: (_)? @function.inside) @function.around + +(block + body: (_)? @function.inside) @function.around ; Parameters (method_parameters - (_) @parameter.inside) + (_) @parameter.inside) @parameter.around (block_parameters - (_) @parameter.inside) + (_) @parameter.inside) @parameter.around (lambda_parameters - (_) @parameter.inside) + (_) @parameter.inside) @parameter.around ; Comments (comment) @comment.inside |