summaryrefslogtreecommitdiff
path: root/vendor/queries/scala/textobjects.scm
blob: 7ff607592915bcd133848c27d68228b6458c1510 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
; Vendored from helix (https://github.com/helix-editor/helix) at 278b24389:
; runtime/queries/scala/textobjects.scm.
; Licensed under the Mozilla Public License 2.0 (vendor/queries/helix.LICENSE,
; https://mozilla.org/MPL/2.0/).

; Function queries

(function_definition
  body: (_) @function.inside) @function.around ; Does not include end marker

(lambda_expression
  (_) @function.inside) @function.around

; Scala 3 braceless lambda
(colon_argument
  (_) @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)

(class_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) (block_comment)] @comment.inside
[(comment) (block_comment)] @comment.around ; Does not match consecutive block comments


; Test queries
; Not supported