aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/ponylang/textobjects.scm
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/queries/ponylang/textobjects.scm')
-rw-r--r--runtime/queries/ponylang/textobjects.scm64
1 files changed, 64 insertions, 0 deletions
diff --git a/runtime/queries/ponylang/textobjects.scm b/runtime/queries/ponylang/textobjects.scm
new file mode 100644
index 00000000..0f24583d
--- /dev/null
+++ b/runtime/queries/ponylang/textobjects.scm
@@ -0,0 +1,64 @@
+;; Queries for helix to select textobjects: https://docs.helix-editor.com/usage.html#textobjects
+;; function.inside
+;; function.around
+;; class.inside
+;; class.around
+;; test.inside
+;; test.around
+;; parameter.inside
+;; comment.inside
+;; comment.around
+
+;; Queries for navigating using textobjects
+
+[
+ (line_comment)
+ (block_comment)
+] @comment.inside
+
+(line_comment)+ @comment.around
+(block_comment) @comment.around
+
+(entity members: (members)? @class.inside) @class.around
+(object members: (members)? @class.inside) @class.around
+
+(method
+ body: (block)? @function.inside
+) @function.around
+(behavior
+ body: (block)? @function.inside
+) @function.around
+(constructor
+ body: (block)? @function.inside
+) @function.around
+(lambda
+ body: (block)? @function.inside
+) @function.outside
+
+(params
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around
+)
+(lambda
+ params: ((_) @parameter.inside . ","? @parameter.around) @parameter.around
+)
+(typeargs
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around
+)
+(typeparams
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around
+)
+(arguments
+ positional: (positional_args
+ ((_) @parameter.inside . ","? @parameter.around)? @parameter.around)
+ ; TODO: get named args right
+ named: (named_args ((_) @parameter.inside . ","? @parameter.around)? @parameter.around)
+)
+
+(
+ (entity
+ provides: (type (nominal_type name: (identifier) @_provides))
+ members: (members) @test.inside
+ ) @test.outside
+ (#eq? @_provides "UnitTest")
+)
+