Skip to content

Commit ab675bd

Browse files
Added support for records in Java (#3359)
1 parent 85971b4 commit ab675bd

33 files changed

Lines changed: 1227 additions & 0 deletions

‎packages/app-web-docs/src/docs/user/languages/fixtures/java.json‎

Lines changed: 366 additions & 0 deletions
Large diffs are not rendered by default.

‎packages/app-web-docs/src/docs/user/languages/java.mdx‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,10 @@ Below are visualizations of all our scope tests for this language. These were cr
357357

358358
<ScopeVisualizer fixtureName="scopes/java/class2" languageId="java" />
359359

360+
<ScopeVisualizer fixtureName="scopes/java/class3" languageId="java" />
361+
362+
<ScopeVisualizer fixtureName="scopes/java/class4" languageId="java" />
363+
360364
#### 2. Class (iteration class)
361365

362366
<i>Iteration scope for classes: class bodies.</i>
@@ -705,6 +709,10 @@ Below are visualizations of all our scope tests for this language. These were cr
705709

706710
<ScopeVisualizer fixtureName="scopes/java/name/name.class2" languageId="java" />
707711

712+
<ScopeVisualizer fixtureName="scopes/java/name/name.class3" languageId="java" />
713+
714+
<ScopeVisualizer fixtureName="scopes/java/name/name.class4" languageId="java" />
715+
708716
#### 8. Name: Constant
709717

710718
<i>Name (LHS) of a constant declaration</i>
@@ -719,6 +727,8 @@ Below are visualizations of all our scope tests for this language. These were cr
719727

720728
<ScopeVisualizer fixtureName="scopes/java/name/name.constructor2" languageId="java" />
721729

730+
<ScopeVisualizer fixtureName="scopes/java/name/name.constructor3" languageId="java" />
731+
722732
#### 10. Name: Enum
723733

724734
<i>Name of an enum declaration</i>
@@ -731,6 +741,8 @@ Below are visualizations of all our scope tests for this language. These were cr
731741

732742
<ScopeVisualizer fixtureName="scopes/java/name/name.field.class" languageId="java" />
733743

744+
<ScopeVisualizer fixtureName="scopes/java/name/name.field.class2" languageId="java" />
745+
734746
#### 12. Name: Field enum
735747

736748
<i>Name (LHS) of a field declaration in an enum</i>
@@ -851,6 +863,8 @@ Below are visualizations of all our scope tests for this language. These were cr
851863

852864
<ScopeVisualizer fixtureName="scopes/java/namedFunction.constructor2" languageId="java" />
853865

866+
<ScopeVisualizer fixtureName="scopes/java/namedFunction.constructor3" languageId="java" />
867+
854868
#### 2. Named function: Method
855869

856870
<i>A method declaration</i>
@@ -859,12 +873,16 @@ Below are visualizations of all our scope tests for this language. These were cr
859873

860874
<ScopeVisualizer fixtureName="scopes/java/namedFunction.method2" languageId="java" />
861875

876+
<ScopeVisualizer fixtureName="scopes/java/namedFunction.method3" languageId="java" />
877+
862878
#### 3. Named function (iteration class)
863879

864880
<i>Iteration scope for named functions: class bodies.</i>
865881

866882
<ScopeVisualizer fixtureName="scopes/java/namedFunction.iteration.class" languageId="java" />
867883

884+
<ScopeVisualizer fixtureName="scopes/java/namedFunction.iteration.class2" languageId="java" />
885+
868886
### Statement
869887

870888
#### 1. Statement: Assignment
@@ -907,6 +925,8 @@ Below are visualizations of all our scope tests for this language. These were cr
907925

908926
<ScopeVisualizer fixtureName="scopes/java/statement/statement.constructor2" languageId="java" />
909927

928+
<ScopeVisualizer fixtureName="scopes/java/statement/statement.constructor3" languageId="java" />
929+
910930
#### 7. Statement: Continue
911931

912932
<i>A continue statement</i>
@@ -931,6 +951,8 @@ Below are visualizations of all our scope tests for this language. These were cr
931951

932952
<ScopeVisualizer fixtureName="scopes/java/statement/statement.field.class" languageId="java" />
933953

954+
<ScopeVisualizer fixtureName="scopes/java/statement/statement.field.class2" languageId="java" />
955+
934956
#### 11. Statement: Field interface
935957

936958
<i>A field declaration in an interface</i>
@@ -983,6 +1005,8 @@ Below are visualizations of all our scope tests for this language. These were cr
9831005

9841006
<ScopeVisualizer fixtureName="scopes/java/statement/statement.method2" languageId="java" />
9851007

1008+
<ScopeVisualizer fixtureName="scopes/java/statement/statement.method3" languageId="java" />
1009+
9861010
#### 19. Statement: Method interface
9871011

9881012
<i>A method declaration in an interface</i>
@@ -1089,6 +1113,8 @@ Below are visualizations of all our scope tests for this language. These were cr
10891113

10901114
<ScopeVisualizer fixtureName="scopes/java/statement/statement.iteration.class2" languageId="java" />
10911115

1116+
<ScopeVisualizer fixtureName="scopes/java/statement/statement.iteration.class3" languageId="java" />
1117+
10921118
#### 35. Statement (iteration document)
10931119

10941120
<i>Iteration scope for statements: the entire document including leading and trailing empty lines.</i>
@@ -1139,6 +1165,12 @@ Below are visualizations of all our scope tests for this language. These were cr
11391165

11401166
<ScopeVisualizer fixtureName="scopes/java/type/type.class" languageId="java" />
11411167

1168+
<ScopeVisualizer fixtureName="scopes/java/type/type.class2" languageId="java" />
1169+
1170+
<ScopeVisualizer fixtureName="scopes/java/type/type.class3" languageId="java" />
1171+
1172+
<ScopeVisualizer fixtureName="scopes/java/type/type.class4" languageId="java" />
1173+
11421174
#### 7. Type: Constant
11431175

11441176
<i>Type of a constant declaration</i>
@@ -1157,6 +1189,8 @@ Below are visualizations of all our scope tests for this language. These were cr
11571189

11581190
<ScopeVisualizer fixtureName="scopes/java/type/type.field.class" languageId="java" />
11591191

1192+
<ScopeVisualizer fixtureName="scopes/java/type/type.field.class2" languageId="java" />
1193+
11601194
#### 10. Type: Field interface
11611195

11621196
<i>Type of a field declaration in an interface</i>
@@ -1289,6 +1323,8 @@ Below are visualizations of all our scope tests for this language. These were cr
12891323

12901324
<ScopeVisualizer fixtureName="scopes/java/value/value.field.class" languageId="java" />
12911325

1326+
<ScopeVisualizer fixtureName="scopes/java/value/value.field.class2" languageId="java" />
1327+
12921328
#### 5. Value: Field interface
12931329

12941330
<i>Value (RHS) of a field declaration in an interface</i>

‎packages/app-web-docs/src/docs/user/scopes/class.mdx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ Default: `class`
6767

6868
<ScopeVisualizer fixtureName="scopes/java/class2" />
6969

70+
<ScopeVisualizer fixtureName="scopes/java/class3" />
71+
72+
<ScopeVisualizer fixtureName="scopes/java/class4" />
73+
7074
##### JavaScript
7175

7276
<ScopeVisualizer fixtureName="scopes/javascript.core/class" />

‎packages/app-web-docs/src/docs/user/scopes/fixtures/class.json‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,40 @@
331331
}
332332
]
333333
},
334+
{
335+
"name": "scopes/java/class3",
336+
"languageId": "java",
337+
"facet": "class",
338+
"code": "record Foo() {}",
339+
"scopes": [
340+
{
341+
"targets": [
342+
{
343+
"content": "0:0-0:15",
344+
"removal": "0:0-0:15"
345+
}
346+
],
347+
"domain": "0:0-0:15"
348+
}
349+
]
350+
},
351+
{
352+
"name": "scopes/java/class4",
353+
"languageId": "java",
354+
"facet": "class",
355+
"code": "@bar\nrecord Foo() {}",
356+
"scopes": [
357+
{
358+
"targets": [
359+
{
360+
"content": "0:0-1:15",
361+
"removal": "0:0-1:15"
362+
}
363+
],
364+
"domain": "0:0-1:15"
365+
}
366+
]
367+
},
334368
{
335369
"name": "scopes/javascript.core/class.iteration.document",
336370
"languageId": "javascript.core",

‎packages/app-web-docs/src/docs/user/scopes/fixtures/name.json‎

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4203,6 +4203,40 @@
42034203
}
42044204
]
42054205
},
4206+
{
4207+
"name": "scopes/java/name/name.class3",
4208+
"languageId": "java",
4209+
"facet": "name.class",
4210+
"code": "record Foo() {}",
4211+
"scopes": [
4212+
{
4213+
"targets": [
4214+
{
4215+
"content": "0:7-0:10",
4216+
"removal": "0:7-0:10"
4217+
}
4218+
],
4219+
"domain": "0:0-0:15"
4220+
}
4221+
]
4222+
},
4223+
{
4224+
"name": "scopes/java/name/name.class4",
4225+
"languageId": "java",
4226+
"facet": "name.class",
4227+
"code": "@Bar\nrecord Foo() {}",
4228+
"scopes": [
4229+
{
4230+
"targets": [
4231+
{
4232+
"content": "1:7-1:10",
4233+
"removal": "1:7-1:10"
4234+
}
4235+
],
4236+
"domain": "0:0-1:15"
4237+
}
4238+
]
4239+
},
42064240
{
42074241
"name": "scopes/java/name/name.constant",
42084242
"languageId": "java",
@@ -4272,6 +4306,32 @@
42724306
}
42734307
]
42744308
},
4309+
{
4310+
"name": "scopes/java/name/name.constructor3",
4311+
"languageId": "java",
4312+
"facet": "name.constructor",
4313+
"code": "record Foo() {\n Foo {}\n}",
4314+
"scopes": [
4315+
{
4316+
"targets": [
4317+
{
4318+
"content": "0:7-0:10",
4319+
"removal": "0:7-0:10"
4320+
}
4321+
],
4322+
"domain": "0:0-2:1"
4323+
},
4324+
{
4325+
"targets": [
4326+
{
4327+
"content": "1:4-1:7",
4328+
"removal": "1:4-1:8"
4329+
}
4330+
],
4331+
"domain": "1:4-1:10"
4332+
}
4333+
]
4334+
},
42754335
{
42764336
"name": "scopes/java/name/name.enum",
42774337
"languageId": "java",
@@ -4333,6 +4393,32 @@
43334393
}
43344394
]
43354395
},
4396+
{
4397+
"name": "scopes/java/name/name.field.class2",
4398+
"languageId": "java",
4399+
"facet": "name.field.class",
4400+
"code": "record Foo() {\n static int bar = 0;\n}",
4401+
"scopes": [
4402+
{
4403+
"targets": [
4404+
{
4405+
"content": "0:7-0:10",
4406+
"removal": "0:7-0:10"
4407+
}
4408+
],
4409+
"domain": "0:0-2:1"
4410+
},
4411+
{
4412+
"targets": [
4413+
{
4414+
"content": "1:15-1:18",
4415+
"removal": "1:4-1:21"
4416+
}
4417+
],
4418+
"domain": "1:4-1:23"
4419+
}
4420+
]
4421+
},
43364422
{
43374423
"name": "scopes/java/name/name.field.enum",
43384424
"languageId": "java",

‎packages/app-web-docs/src/docs/user/scopes/fixtures/namedFunction.json‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,23 @@
532532
}
533533
]
534534
},
535+
{
536+
"name": "scopes/java/namedFunction.constructor3",
537+
"languageId": "java",
538+
"facet": "namedFunction.constructor",
539+
"code": "record Foo() {\n Foo {}\n}",
540+
"scopes": [
541+
{
542+
"targets": [
543+
{
544+
"content": "1:4-1:10",
545+
"removal": "1:0-2:0"
546+
}
547+
],
548+
"domain": "1:4-1:10"
549+
}
550+
]
551+
},
535552
{
536553
"name": "scopes/java/namedFunction.iteration.class",
537554
"languageId": "java",
@@ -548,6 +565,22 @@
548565
}
549566
]
550567
},
568+
{
569+
"name": "scopes/java/namedFunction.iteration.class2",
570+
"languageId": "java",
571+
"facet": "namedFunction.iteration.class",
572+
"code": "record Foo() { }",
573+
"scopes": [
574+
{
575+
"targets": [
576+
{
577+
"content": "0:14-0:15"
578+
}
579+
],
580+
"domain": "0:14-0:15"
581+
}
582+
]
583+
},
551584
{
552585
"name": "scopes/java/namedFunction.method",
553586
"languageId": "java",
@@ -582,6 +615,23 @@
582615
}
583616
]
584617
},
618+
{
619+
"name": "scopes/java/namedFunction.method3",
620+
"languageId": "java",
621+
"facet": "namedFunction.method",
622+
"code": "record Foo() {\n void bar() {}\n}",
623+
"scopes": [
624+
{
625+
"targets": [
626+
{
627+
"content": "1:4-1:17",
628+
"removal": "1:0-2:0"
629+
}
630+
],
631+
"domain": "1:4-1:17"
632+
}
633+
]
634+
},
585635
{
586636
"name": "scopes/javascript.core/namedFunction/namedFunction.constructor",
587637
"languageId": "javascript.core",

0 commit comments

Comments
 (0)