Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions data/fixtures/scopes/java/condition/condition.switchCase2.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
switch (value) {
case 1, 2:
break;
case 3, 4:
break;
default:
break;
}
---

[#1.1 Content] = 1:9-1:10
>-<
1| case 1, 2:

[#1.1 Removal] = 1:8-1:10
>--<
1| case 1, 2:

[#1.1 Leading delimiter] = 1:8-1:9
>-<
1| case 1, 2:

[#1.1 Insertion delimiter] = " "

[#1.2 Content] = 1:12-1:13
>-<
1| case 1, 2:

[#1.2 Removal] = 1:11-1:13
>--<
1| case 1, 2:

[#1.2 Leading delimiter] = 1:11-1:12
>-<
1| case 1, 2:

[#1.2 Insertion delimiter] = " "

[#1 Domain] = 1:4-2:14
>----------
1| case 1, 2:
2| break;
--------------<


[#2.1 Content] = 3:9-3:10
>-<
3| case 3, 4:

[#2.1 Removal] = 3:8-3:10
>--<
3| case 3, 4:

[#2.1 Leading delimiter] = 3:8-3:9
>-<
3| case 3, 4:

[#2.1 Insertion delimiter] = " "

[#2.2 Content] = 3:12-3:13
>-<
3| case 3, 4:

[#2.2 Removal] = 3:11-3:13
>--<
3| case 3, 4:

[#2.2 Leading delimiter] = 3:11-3:12
>-<
3| case 3, 4:

[#2.2 Insertion delimiter] = " "

[#2 Domain] = 3:4-4:14
>----------
3| case 3, 4:
4| break;
--------------<
153 changes: 153 additions & 0 deletions data/fixtures/scopes/java/interior/interior.switchCase2.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
switch (value) {
case 0 -> foo;
case 1 -> bar;
default -> {
yield baz;
}
}
---

[#1 Content] = 1:4-5:5
>--------------
1| case 0 -> foo;
2| case 1 -> bar;
3| default -> {
4| yield baz;
5| }
-----<

[#1 Removal] = 0:16-6:0
>
0| switch (value) {
1| case 0 -> foo;
2| case 1 -> bar;
3| default -> {
4| yield baz;
5| }
6| }
<

[#1 Domain] = 0:0-6:1
>----------------
0| switch (value) {
1| case 0 -> foo;
2| case 1 -> bar;
3| default -> {
4| yield baz;
5| }
6| }
-<

[#1 Insertion delimiter] = " "


[#2 Content] =
[#2 Removal] = 0:8-0:13
>-----<
0| switch (value) {

[#2 Domain] = 0:7-0:14
>-------<
0| switch (value) {

[#2 Insertion delimiter] = " "


[#3 Content] = 1:4-5:5
>--------------
1| case 0 -> foo;
2| case 1 -> bar;
3| default -> {
4| yield baz;
5| }
-----<

[#3 Removal] = 0:16-6:0
>
0| switch (value) {
1| case 0 -> foo;
2| case 1 -> bar;
3| default -> {
4| yield baz;
5| }
6| }
<

[#3 Domain] = 0:15-6:1
>-
0| switch (value) {
1| case 0 -> foo;
2| case 1 -> bar;
3| default -> {
4| yield baz;
5| }
6| }
-<

[#3 Insertion delimiter] = " "


[#4 Content] =
[#4 Removal] = 1:14-1:18
>----<
1| case 0 -> foo;

[#4 Domain] = 1:4-1:18
>--------------<
1| case 0 -> foo;

[#4 Insertion delimiter] = " "


[#5 Content] =
[#5 Removal] = 2:14-2:18
>----<
2| case 1 -> bar;

[#5 Domain] = 2:4-2:18
>--------------<
2| case 1 -> bar;

[#5 Insertion delimiter] = " "


[#6 Content] = 4:8-4:18
>----------<
4| yield baz;

[#6 Removal] = 3:16-5:4
>
3| default -> {
4| yield baz;
5| }
----<

[#6 Domain] = 3:4-5:5
>------------
3| default -> {
4| yield baz;
5| }
-----<

[#6 Insertion delimiter] = " "


[#7 Content] = 4:8-4:18
>----------<
4| yield baz;

[#7 Removal] = 3:16-5:4
>
3| default -> {
4| yield baz;
5| }
----<

[#7 Domain] = 3:15-5:5
>-
3| default -> {
4| yield baz;
5| }
-----<

[#7 Insertion delimiter] = " "
44 changes: 44 additions & 0 deletions data/fixtures/scopes/java/value/value.yield.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
switch (value) {
case 1:
yield "foo";
default:
yield "bar";
}
---

[#1 Content] = 2:14-2:19
>-----<
2| yield "foo";

[#1 Removal] = 2:13-2:19
>------<
2| yield "foo";

[#1 Leading delimiter] = 2:13-2:14
>-<
2| yield "foo";

[#1 Domain] = 2:8-2:20
>------------<
2| yield "foo";

[#1 Insertion delimiter] = " "


[#2 Content] = 4:14-4:19
>-----<
4| yield "bar";

[#2 Removal] = 4:13-4:19
>------<
4| yield "bar";

[#2 Leading delimiter] = 4:13-4:14
>-<
4| yield "bar";

[#2 Domain] = 4:8-4:20
>------------<
4| yield "bar";

[#2 Insertion delimiter] = " "
2 changes: 1 addition & 1 deletion packages/common/src/scopeSupportFacets/java.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = {
"value.foreach": supported,
"value.field.class": supported,
"value.return": supported,
"value.yield": supported,
"value.return.lambda": supported,
"value.variable": supported,
"value.resource": supported,
Expand Down Expand Up @@ -289,7 +290,6 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = {
"value.iteration.enum": notApplicable,

// Miscellaneous
"value.yield": notApplicable,
pairDelimiter: notApplicable,
regularExpression: notApplicable,
environment: notApplicable,
Expand Down
13 changes: 11 additions & 2 deletions queries/java.scm
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
(switch_label
(_) @condition
)
(#allow-multiple! @condition)
) @condition.domain

;;!! case "0" -> "zero";
Expand Down Expand Up @@ -524,10 +525,18 @@
;;! ^^^^^
;;! -------------
(
(return_statement) @value @_.domain
(#child-range! @value 1 -2)
(return_statement
(_) @value
) @_.domain
)

;;!! yield value;
;;! ^^^^^
;;! ------------
(yield_statement
(_) @value
) @_.domain

;;!! str -> str.length > 0
;;! ^^^^^^^^^^^^^^
;;! ---------------------
Expand Down
Loading