Skip to content

Commit 6941e58

Browse files
More tests
1 parent ae4f816 commit 6941e58

File tree

5 files changed

+182
-52
lines changed

5 files changed

+182
-52
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
public class MyClass {
2+
public MyClass(String name, int value) { }
3+
}
4+
---
5+
6+
[Range] = 1:19-1:41
7+
>----------------------<
8+
1| public MyClass(String name, int value) { }
9+
10+
[Domain] = 1:18-1:42
11+
>------------------------<
12+
1| public MyClass(String name, int value) { }
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
public class MyClass {
2+
public MyClass(String name, int value) { }
3+
}
4+
---
5+
6+
[#1 Content] = 0:13-0:20
7+
>-------<
8+
0| public class MyClass {
9+
10+
[#1 Removal] = 0:13-0:21
11+
>--------<
12+
0| public class MyClass {
13+
14+
[#1 Leading delimiter] = 0:12-0:13
15+
>-<
16+
0| public class MyClass {
17+
18+
[#1 Trailing delimiter] = 0:20-0:21
19+
>-<
20+
0| public class MyClass {
21+
22+
[#1 Domain] = 0:0-2:1
23+
>----------------------
24+
0| public class MyClass {
25+
1| public MyClass(String name, int value) { }
26+
2| }
27+
-<
28+
29+
[#1 Insertion delimiter] = " "
30+
31+
32+
[#2 Content] =
33+
[#2 Removal] = 1:11-1:18
34+
>-------<
35+
1| public MyClass(String name, int value) { }
36+
37+
[#2 Leading delimiter] = 1:10-1:11
38+
>-<
39+
1| public MyClass(String name, int value) { }
40+
41+
[#2 Domain] = 1:4-1:46
42+
>------------------------------------------<
43+
1| public MyClass(String name, int value) { }
44+
45+
[#2 Insertion delimiter] = " "
46+
47+
48+
[#3 Content] = 1:26-1:30
49+
>----<
50+
1| public MyClass(String name, int value) { }
51+
52+
[#3 Removal] = 1:25-1:30
53+
>-----<
54+
1| public MyClass(String name, int value) { }
55+
56+
[#3 Leading delimiter] = 1:25-1:26
57+
>-<
58+
1| public MyClass(String name, int value) { }
59+
60+
[#3 Domain] = 1:19-1:30
61+
>-----------<
62+
1| public MyClass(String name, int value) { }
63+
64+
[#3 Insertion delimiter] = " "
65+
66+
67+
[#4 Content] = 1:36-1:41
68+
>-----<
69+
1| public MyClass(String name, int value) { }
70+
71+
[#4 Removal] = 1:35-1:41
72+
>------<
73+
1| public MyClass(String name, int value) { }
74+
75+
[#4 Leading delimiter] = 1:35-1:36
76+
>-<
77+
1| public MyClass(String name, int value) { }
78+
79+
[#4 Domain] = 1:32-1:41
80+
>---------<
81+
1| public MyClass(String name, int value) { }
82+
83+
[#4 Insertion delimiter] = " "
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
public class MyClass {
2+
public void foo(String name, int value) { }
3+
}
4+
---
5+
6+
[Range] = 1:20-1:42
7+
>----------------------<
8+
1| public void foo(String name, int value) { }
9+
10+
[Domain] = 1:19-1:43
11+
>------------------------<
12+
1| public void foo(String name, int value) { }

packages/common/src/scopeSupportFacets/java.ts

Lines changed: 63 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,24 @@ const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;
55

66
export const javaScopeSupport: LanguageScopeSupportFacetMap = {
77
disqualifyDelimiter: supported,
8+
anonymousFunction: supported,
9+
list: supported,
10+
map: supported,
11+
pairDelimiter: supported,
12+
switchStatementSubject: supported,
813

9-
"name.foreach": supported,
10-
11-
"value.foreach": supported,
12-
13-
"type.foreach": supported,
14-
"type.field": supported,
15-
"type.field.iteration": supported,
16-
"type.typeArgument": supported,
17-
"type.typeArgument.iteration": supported,
18-
19-
"argument.formal": supported,
20-
"argument.formal.iteration": supported,
2114
"argument.actual": supported,
2215
"argument.actual.iteration": supported,
16+
"argument.actual.constructor": supported,
17+
"argument.actual.constructor.iteration": supported,
18+
"argument.actual.method": supported,
19+
"argument.actual.method.iteration": supported,
20+
"argument.formal": supported,
21+
"argument.formal.iteration": supported,
22+
"argument.formal.constructor": supported,
23+
"argument.formal.constructor.iteration": supported,
24+
"argument.formal.method": supported,
25+
"argument.formal.method.iteration": supported,
2326

2427
"collectionItem.unenclosed": supported,
2528
"collectionItem.unenclosed.iteration": supported,
@@ -29,45 +32,35 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = {
2932
"branch.try": supported,
3033
"branch.try.iteration": supported,
3134

32-
anonymousFunction: supported,
33-
"argument.actual.constructor": supported,
34-
"argument.actual.constructor.iteration": supported,
35-
"argument.actual.method": supported,
36-
"argument.actual.method.iteration": supported,
37-
"argument.formal.constructor": supported,
38-
"argument.formal.constructor.iteration": supported,
39-
"argument.formal.method": supported,
40-
"argument.formal.method.iteration": supported,
4135
"branch.switchCase": supported,
4236
"branch.switchCase.iteration": supported,
4337
"branch.ternary": supported,
38+
4439
class: supported,
4540
className: supported,
41+
4642
"comment.block": supported,
4743
"comment.line": supported,
44+
4845
"condition.doWhile": supported,
4946
"condition.for": supported,
5047
"condition.if": supported,
5148
"condition.switchCase": supported,
5249
"condition.switchCase.iteration": supported,
5350
"condition.ternary": supported,
5451
"condition.while": supported,
52+
5553
functionCall: supported,
5654
"functionCall.constructor": supported,
5755
functionCallee: supported,
5856
"functionCallee.constructor": supported,
59-
functionName: supported,
57+
6058
"functionName.constructor": supported,
61-
"functionName.iteration.block": supported,
62-
"functionName.iteration.document": supported,
6359
"functionName.method": supported,
64-
"functionName.method.iteration.class": supported,
65-
ifStatement: supported,
6660

6761
"key.mapPair": supported,
6862
"key.mapPair.iteration": supported,
69-
list: supported,
70-
map: supported,
63+
7164
"name.argument.formal.constructor": supported,
7265
"name.argument.formal.constructor.iteration": supported,
7366
"name.argument.formal.method": supported,
@@ -76,29 +69,34 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = {
7669
"name.class": supported,
7770
"name.constructor": supported,
7871
"name.field": supported,
72+
"name.foreach": supported,
7973
"name.iteration.block": supported,
8074
"name.iteration.document": supported,
8175
"name.method": supported,
8276
"name.variable": supported,
8377
"name.variable.pattern": supported,
84-
namedFunction: supported,
8578
"namedFunction.constructor": supported,
8679
"namedFunction.iteration.block": supported,
8780
"namedFunction.iteration.document": supported,
8881
"namedFunction.method": supported,
89-
"namedFunction.method.iteration.class": supported,
90-
pairDelimiter: supported,
82+
83+
ifStatement: supported,
9184
statement: supported,
9285
"statement.class": supported,
9386
"statement.iteration.block": supported,
9487
"statement.iteration.document": supported,
88+
9589
"string.multiLine": supported,
9690
"string.singleLine": supported,
97-
switchStatementSubject: supported,
91+
9892
"textFragment.comment.block": supported,
9993
"textFragment.comment.line": supported,
10094
"textFragment.string.multiLine": supported,
10195
"textFragment.string.singleLine": supported,
96+
97+
"type.typeArgument": supported,
98+
"type.typeArgument.iteration": supported,
99+
102100
"type.alias": supported,
103101
"type.argument.formal": supported,
104102
"type.argument.formal.constructor": supported,
@@ -109,18 +107,19 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = {
109107
"type.cast": supported,
110108
"type.class": supported,
111109
"type.enum": supported,
110+
"type.foreach": supported,
111+
"type.field": supported,
112+
"type.field.iteration": supported,
112113
"type.interface": supported,
113114
"type.return": supported,
114115
"type.variable": supported,
115-
"value.argument.actual": supported,
116-
"value.argument.actual.iteration": supported,
117-
"value.argument.formal": supported,
116+
118117
"value.argument.formal.constructor": supported,
119118
"value.argument.formal.constructor.iteration": supported,
120-
"value.argument.formal.iteration": supported,
121119
"value.argument.formal.method": supported,
122120
"value.argument.formal.method.iteration": supported,
123121
"value.assignment": supported,
122+
"value.foreach": supported,
124123
"value.field": supported,
125124
"value.mapPair": supported,
126125
"value.mapPair.iteration": supported,
@@ -134,16 +133,20 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = {
134133

135134
// Unsupported
136135

137-
"branch.loop": unsupported,
138136
"class.iteration.block": unsupported,
139137
"class.iteration.document": unsupported,
140138
"className.iteration.block": unsupported,
141139
"className.iteration.document": unsupported,
142-
fieldAccess: unsupported,
143140

144141
"name.resource": unsupported,
145142
"name.resource.iteration": unsupported,
146143

144+
"namedFunction.method.iteration.class": unsupported,
145+
146+
"functionName.iteration.block": unsupported,
147+
"functionName.iteration.document": unsupported,
148+
"functionName.method.iteration.class": unsupported,
149+
147150
"interior.class": unsupported,
148151
"interior.element": unsupported,
149152
"interior.function": unsupported,
@@ -155,6 +158,9 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = {
155158
"interior.ternary": unsupported,
156159
"interior.try": unsupported,
157160

161+
"branch.loop": unsupported,
162+
fieldAccess: unsupported,
163+
158164
// Not Applicable
159165

160166
"name.assignment.pattern": notApplicable,
@@ -165,23 +171,32 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = {
165171
"name.function": notApplicable,
166172

167173
"value.variable": notApplicable,
174+
"value.attribute": notApplicable,
175+
"value.argument.actual": notApplicable,
176+
"value.argument.actual.iteration": notApplicable,
177+
"value.argument.formal": notApplicable,
178+
"value.argument.formal.iteration": supported,
168179

169-
regularExpression: notApplicable,
180+
section: notApplicable,
181+
"section.iteration.document": notApplicable,
182+
"section.iteration.parent": notApplicable,
183+
184+
element: notApplicable,
185+
tags: notApplicable,
186+
startTag: notApplicable,
187+
endTag: notApplicable,
188+
"textFragment.element": notApplicable,
189+
190+
namedFunction: notApplicable,
170191

192+
functionName: notApplicable,
193+
194+
regularExpression: notApplicable,
171195
environment: notApplicable,
172196
"interior.cell": notApplicable,
173197
"interior.command": notApplicable,
174198
"key.attribute": notApplicable,
175199
notebookCell: notApplicable,
176-
"section.iteration.document": notApplicable,
177-
"section.iteration.parent": notApplicable,
178-
section: notApplicable,
179-
"textFragment.element": notApplicable,
180-
"value.attribute": notApplicable,
181200
attribute: notApplicable,
182201
command: notApplicable,
183-
element: notApplicable,
184-
tags: notApplicable,
185-
startTag: notApplicable,
186-
endTag: notApplicable,
187202
};

queries/java.scm

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,19 @@
230230
;;!! void myFunk(int value) {}
231231
;;! ^^^^^
232232
;;! -------------------------
233+
(formal_parameter
234+
(identifier) @name
235+
) @_.domain
236+
237+
;;!! void myFunk(int value) {}
238+
;;! ^^^^^^^^^
233239
(formal_parameters
234-
(formal_parameter
235-
(identifier) @name
236-
) @_.domain
237-
) @_.iteration
240+
.
241+
"(" @name.iteration.start.endOf
242+
243+
")" @name.iteration.end.startOf
244+
.
245+
) @name.iteration.domain
238246

239247
;;!! Map<String, String>
240248
;;! ^^^^^^^ ^^^^^^

0 commit comments

Comments
 (0)