Skip to content

Commit a6e826d

Browse files
java
1 parent 8412248 commit a6e826d

File tree

8 files changed

+162
-10
lines changed

8 files changed

+162
-10
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
public enum Foo { }
2+
---
3+
4+
[#1 Content] =
5+
[#1 Removal] = 0:17-0:18
6+
>-<
7+
0| public enum Foo { }
8+
9+
[#1 Domain] = 0:0-0:19
10+
>-------------------<
11+
0| public enum Foo { }
12+
13+
[#1 Insertion delimiter] = " "
14+
15+
16+
[#2 Content] =
17+
[#2 Removal] = 0:17-0:18
18+
>-<
19+
0| public enum Foo { }
20+
21+
[#2 Domain] = 0:16-0:19
22+
>---<
23+
0| public enum Foo { }
24+
25+
[#2 Insertion delimiter] = " "
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
public enum Foo {}
2+
---
3+
4+
[Content] = 0:12-0:15
5+
>---<
6+
0| public enum Foo {}
7+
8+
[Removal] = 0:12-0:16
9+
>----<
10+
0| public enum Foo {}
11+
12+
[Leading delimiter] = 0:11-0:12
13+
>-<
14+
0| public enum Foo {}
15+
16+
[Trailing delimiter] = 0:15-0:16
17+
>-<
18+
0| public enum Foo {}
19+
20+
[Domain] = 0:0-0:18
21+
>------------------<
22+
0| public enum Foo {}
23+
24+
[Insertion delimiter] = " "
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
public enum Foo {
2+
bar,
3+
baz;
4+
}
5+
---
6+
7+
[#1 Content] = 0:12-0:15
8+
>---<
9+
0| public enum Foo {
10+
11+
[#1 Removal] = 0:12-0:16
12+
>----<
13+
0| public enum Foo {
14+
15+
[#1 Leading delimiter] = 0:11-0:12
16+
>-<
17+
0| public enum Foo {
18+
19+
[#1 Trailing delimiter] = 0:15-0:16
20+
>-<
21+
0| public enum Foo {
22+
23+
[#1 Domain] = 0:0-3:1
24+
>-----------------
25+
0| public enum Foo {
26+
1| bar,
27+
2| baz;
28+
3| }
29+
-<
30+
31+
[#1 Insertion delimiter] = " "
32+
33+
34+
[#2 Content] =
35+
[#2 Domain] = 1:4-1:7
36+
>---<
37+
1| bar,
38+
39+
[#2 Removal] = 1:0-1:7
40+
>-------<
41+
1| bar,
42+
43+
[#2 Leading delimiter] = 1:0-1:4
44+
>----<
45+
1| bar,
46+
47+
[#2 Insertion delimiter] = " "
48+
49+
50+
[#3 Content] =
51+
[#3 Domain] = 2:4-2:7
52+
>---<
53+
2| baz;
54+
55+
[#3 Removal] = 2:0-2:7
56+
>-------<
57+
2| baz;
58+
59+
[#3 Leading delimiter] = 2:0-2:4
60+
>----<
61+
2| baz;
62+
63+
[#3 Insertion delimiter] = " "
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
public enum Foo { }
2+
---
3+
4+
[#1 Range] =
5+
[#1 Domain] = 0:0-0:19
6+
>-------------------<
7+
0| public enum Foo { }
8+
9+
10+
[#2 Range] =
11+
[#2 Domain] = 0:17-0:18
12+
>-<
13+
0| public enum Foo { }
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
public enum Foo {}
2+
---
3+
4+
[Content] =
5+
[Removal] =
6+
[Domain] = 0:0-0:18
7+
>------------------<
8+
0| public enum Foo {}
9+
10+
[Insertion delimiter] = "\n"
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
public enum Value {
2-
A;
3-
}
1+
public enum Foo {}
42
---
53

64
[Content] =
75
[Removal] =
8-
[Domain] = 0:0-2:1
9-
>-------------------
10-
0| public enum Value {
11-
1| A;
12-
2| }
13-
-<
6+
[Domain] = 0:0-0:18
7+
>------------------<
8+
0| public enum Foo {}
149

1510
[Insertion delimiter] = " "

packages/common/src/scopeSupportFacets/java.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = {
9898
statement: supported,
9999
"statement.class": supported,
100100
"statement.interface": supported,
101+
"statement.enum": supported,
101102
"statement.field.class": supported,
102103
"statement.field.interface": supported,
103104
"statement.iteration.block": supported,
@@ -121,15 +122,18 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = {
121122
"name.assignment": supported,
122123
"name.class": supported,
123124
"name.interface": supported,
125+
"name.enum": supported,
124126
"name.constructor": supported,
125127
"name.field.class": supported,
126128
"name.field.interface": supported,
129+
"name.field.enum": supported,
127130
"name.foreach": supported,
128131
"name.method": supported,
129132
"name.variable": supported,
130133
"name.iteration.document": supported,
131134
"name.iteration.class": supported,
132135
"name.iteration.interface": supported,
136+
"name.iteration.enum": supported,
133137
"name.iteration.block": supported,
134138
"name.resource": supported,
135139

@@ -168,6 +172,7 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = {
168172

169173
"interior.class": supported,
170174
"interior.interface": supported,
175+
"interior.enum": supported,
171176
"interior.constructor": supported,
172177
"interior.method": supported,
173178
"interior.if": supported,
@@ -279,6 +284,10 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = {
279284
"branch.loop": notApplicable,
280285
"branch.loop.iteration": notApplicable,
281286

287+
// Values in enum
288+
"value.field.enum": notApplicable,
289+
"value.iteration.enum": notApplicable,
290+
282291
// Miscellaneous
283292
"value.yield": notApplicable,
284293
pairDelimiter: notApplicable,

queries/java.scm

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,20 @@
4343

4444
;;!! enum Foo {}
4545
;;! ^^^^^^^^^^^
46-
(enum_declaration) @type
46+
;;! ^^^
47+
(enum_declaration
48+
name: (_) @name
49+
body: (_
50+
"{" @interior.start.endOf @name.iteration.start.endOf
51+
"}" @interior.end.startOf @name.iteration.end.startOf
52+
)
53+
) @type @name.domain @interior.domain
54+
55+
;;!! enum Foo { bar, baz }
56+
;;! ^^^ ^^^
57+
(enum_constant
58+
name: (_) @name
59+
) @_.domain
4760

4861
;;!! class Foo {}
4962
;;! ^^^^^^^^^^^^

0 commit comments

Comments
 (0)