aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorJaakko Paju2024-01-08 02:05:10 +0000
committerGitHub2024-01-08 02:05:10 +0000
commit73deba70443073c0171b292dba0e9f3ef2648754 (patch)
tree6fa2507f79c13a6b2b7bca3821b5cfc6655fdbc6 /runtime
parenta32d537d0ab61c29dca556d6ffe35431d9f4f1d1 (diff)
Add textobject queries for Scala (#9191)
Diffstat (limited to 'runtime')
-rw-r--r--runtime/queries/scala/textobjects.scm59
1 files changed, 59 insertions, 0 deletions
diff --git a/runtime/queries/scala/textobjects.scm b/runtime/queries/scala/textobjects.scm
new file mode 100644
index 00000000..fe0b8c25
--- /dev/null
+++ b/runtime/queries/scala/textobjects.scm
@@ -0,0 +1,59 @@
+; Function queries
+
+(function_definition
+ body: (_) @function.inside) @function.around
+
+; Does not match block lambdas or Scala 3 braceless lambdas
+(lambda_expression
+ (_) @function.inside) @function.around
+
+
+; Class queries
+
+(object_definition
+ body: (_)? @class.inside) @class.around
+
+(class_definition
+ body: (_)? @class.inside) @class.around
+
+(trait_definition
+ body: (_)? @class.inside) @class.around
+
+(type_definition) @class.around
+
+(enum_case_definitions) @class.around
+
+(enum_definition
+ body: (_)? @class.inside) @class.around
+
+
+; Parameter queries
+
+(parameters
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
+
+(parameter_types
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
+
+(bindings
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
+
+; Does not match context bounds or higher-kinded types
+(type_parameters
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
+
+(arguments
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
+
+(type_arguments
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
+
+
+; Comment queries
+
+(comment) @comment.inside
+(comment) @comment.around ; Does not match consecutive block comments
+
+
+; Test queries
+; Not supported