aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries
diff options
context:
space:
mode:
authorDanillo Melo2022-04-18 00:25:44 +0000
committerGitHub2022-04-18 00:25:44 +0000
commitbe656c14e32243fc32ed68f9a3240301f2902df7 (patch)
tree9001d1d917937061bfb099b5787be999235fb53c /runtime/queries
parentad36a024da4dae0cc096cae8ab83740507bc8d8a (diff)
Ruby TextObjects and more file extensions (#2143)
Diffstat (limited to 'runtime/queries')
-rw-r--r--runtime/queries/ruby/textobjects.scm54
1 files changed, 54 insertions, 0 deletions
diff --git a/runtime/queries/ruby/textobjects.scm b/runtime/queries/ruby/textobjects.scm
new file mode 100644
index 00000000..34888c17
--- /dev/null
+++ b/runtime/queries/ruby/textobjects.scm
@@ -0,0 +1,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