Skip to content

Commit a3d021d

Browse files
committed
vendor rescript-react for testing
1 parent 878233f commit a3d021d

29 files changed

+1493
-27
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"nyc": "15.0.0"
8080
},
8181
"workspaces": [
82+
"tests/dependencies/**",
8283
"tests/analysis_tests/**",
8384
"tests/gentype_tests/**",
8485
"tests/tools_tests"

tests/analysis_tests/tests-reanalyze/deadcode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"clean": "rescript clean -with-deps"
77
},
88
"dependencies": {
9-
"@rescript/react": "^0.13.1",
9+
"@rescript/react": "workspace:tests/dependencies/rescript-react",
1010
"rescript": "workspace:^"
1111
}
1212
}

tests/analysis_tests/tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"clean": "rescript clean -with-deps"
77
},
88
"dependencies": {
9-
"@rescript/react": "^0.13.1",
9+
"@rescript/react": "workspace:tests/dependencies/rescript-react",
1010
"rescript": "workspace:^"
1111
}
1212
}

tests/analysis_tests/tests/src/expected/Completion.res.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,6 +1912,16 @@ Path Res
19121912
"tags": [],
19131913
"detail": "module Result",
19141914
"documentation": null
1915+
}, {
1916+
"label": "RescriptReactErrorBoundary",
1917+
"kind": 9,
1918+
"tags": [],
1919+
"detail": "module RescriptReactErrorBoundary",
1920+
"documentation": null,
1921+
"data": {
1922+
"modulePath": "RescriptReactErrorBoundary",
1923+
"filePath": "src/Completion.res"
1924+
}
19151925
}, {
19161926
"label": "RescriptTools",
19171927
"kind": 9,

tests/analysis_tests/tests/src/expected/CompletionExpressions.res.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,13 +865,13 @@ ContextPath CArgument Value[fnTakingCallback]($2)
865865
ContextPath Value[fnTakingCallback]
866866
Path fnTakingCallback
867867
[{
868-
"label": "mouse => mouse",
868+
"label": "event => event",
869869
"kind": 12,
870870
"tags": [],
871871
"detail": "ReactEvent.Mouse.t => unit",
872872
"documentation": null,
873873
"sortText": "A",
874-
"insertText": "${1:mouse} => ${0:mouse}",
874+
"insertText": "${1:event} => ${0:event}",
875875
"insertTextFormat": 2
876876
}]
877877

tests/analysis_tests/tests/src/expected/CompletionInferValues.res.txt

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,15 @@ ContextPath CArgument CArgument Value[reactEventFn]($0)($0)
245245
ContextPath CArgument Value[reactEventFn]($0)
246246
ContextPath Value[reactEventFn]
247247
Path reactEventFn
248-
[]
248+
CPPipe pathFromEnv:ReactEvent.Mouse found:false
249+
Path ReactEvent.Mouse.pr
250+
[{
251+
"label": "ReactEvent.Mouse.preventDefault",
252+
"kind": 12,
253+
"tags": [],
254+
"detail": "t => unit",
255+
"documentation": null
256+
}]
249257

250258
Complete src/CompletionInferValues.res 41:50
251259
posCursor:[41:50] posNoWhite:[41:49] Found expr:[41:12->41:56]
@@ -261,7 +269,16 @@ Path event
261269
ContextPath CArgument CJsxPropValue [div] onMouseEnter($0)
262270
ContextPath CJsxPropValue [div] onMouseEnter
263271
Path ReactDOM.domProps
264-
[]
272+
Path JsxDOM.domProps
273+
CPPipe pathFromEnv:JsxEvent.Mouse found:false
274+
Path JsxEvent.Mouse.pr
275+
[{
276+
"label": "JsxEvent.Mouse.preventDefault",
277+
"kind": 12,
278+
"tags": [],
279+
"detail": "t => unit",
280+
"documentation": null
281+
}]
265282

266283
Complete src/CompletionInferValues.res 44:50
267284
posCursor:[44:50] posNoWhite:[44:49] Found expr:[44:12->44:56]
@@ -793,7 +810,21 @@ ContextPath CArgument CArgument Value[fn2](~cb)($0)
793810
ContextPath CArgument Value[fn2](~cb)
794811
ContextPath Value[fn2]
795812
Path fn2
796-
[]
813+
CPPipe pathFromEnv:ReactDOM.Client.Root found:false
814+
Path ReactDOM.Client.Root.
815+
[{
816+
"label": "ReactDOM.Client.Root.unmount",
817+
"kind": 12,
818+
"tags": [],
819+
"detail": "(t, unit) => unit",
820+
"documentation": null
821+
}, {
822+
"label": "ReactDOM.Client.Root.render",
823+
"kind": 12,
824+
"tags": [],
825+
"detail": "(t, React.element) => unit",
826+
"documentation": null
827+
}]
797828

798829
Complete src/CompletionInferValues.res 139:30
799830
posCursor:[139:30] posNoWhite:[139:29] Found expr:[139:3->139:33]
@@ -918,7 +949,21 @@ ContextPath CArgument CArgument Value[CompletionSupport2, makeRenderer](~render)
918949
ContextPath CArgument Value[CompletionSupport2, makeRenderer](~render)
919950
ContextPath Value[CompletionSupport2, makeRenderer]
920951
Path CompletionSupport2.makeRenderer
921-
[]
952+
CPPipe pathFromEnv:ReactDOM.Client.Root found:false
953+
Path ReactDOM.Client.Root.
954+
[{
955+
"label": "ReactDOM.Client.Root.unmount",
956+
"kind": 12,
957+
"tags": [],
958+
"detail": "(t, unit) => unit",
959+
"documentation": null
960+
}, {
961+
"label": "ReactDOM.Client.Root.render",
962+
"kind": 12,
963+
"tags": [],
964+
"detail": "(t, React.element) => unit",
965+
"documentation": null
966+
}]
922967

923968
Hover src/CompletionInferValues.res 160:27
924969
Nothing at that position. Now trying to use completion.

tests/analysis_tests/tests/src/expected/CompletionJsx.res.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,8 +578,14 @@ Completable: Cjsx([h1], hidd, [hidd])
578578
Package opens Stdlib.place holder Pervasives.JsxModules.place holder
579579
Resolved opens 1 Stdlib
580580
Path ReactDOM.domProps
581-
[completing-lowercase-jsx] could not find element props to complete from.
582-
[]
581+
Path JsxDOM.domProps
582+
[{
583+
"label": "hidden",
584+
"kind": 4,
585+
"tags": [],
586+
"detail": "bool",
587+
"documentation": null
588+
}]
583589

584590
Complete src/CompletionJsx.res 61:30
585591
posCursor:[61:30] posNoWhite:[61:28] Found expr:[61:4->61:29]

tests/analysis_tests/tests/src/expected/CompletionJsxProps.res.txt

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,20 @@ Package opens Stdlib.place holder Pervasives.JsxModules.place holder
223223
Resolved opens 1 Stdlib
224224
ContextPath CJsxPropValue [div] muted
225225
Path ReactDOM.domProps
226-
[]
226+
Path JsxDOM.domProps
227+
[{
228+
"label": "true",
229+
"kind": 4,
230+
"tags": [],
231+
"detail": "bool",
232+
"documentation": null
233+
}, {
234+
"label": "false",
235+
"kind": 4,
236+
"tags": [],
237+
"detail": "bool",
238+
"documentation": null
239+
}]
227240

228241
Complete src/CompletionJsxProps.res 18:29
229242
posCursor:[18:29] posNoWhite:[18:28] Found expr:[18:12->18:32]
@@ -233,7 +246,17 @@ Package opens Stdlib.place holder Pervasives.JsxModules.place holder
233246
Resolved opens 1 Stdlib
234247
ContextPath CJsxPropValue [div] onMouseEnter
235248
Path ReactDOM.domProps
236-
[]
249+
Path JsxDOM.domProps
250+
[{
251+
"label": "event => event",
252+
"kind": 12,
253+
"tags": [],
254+
"detail": "JsxEvent.Mouse.t => unit",
255+
"documentation": null,
256+
"sortText": "A",
257+
"insertText": "{${1:event} => ${0:event}}",
258+
"insertTextFormat": 2
259+
}]
237260

238261
Complete src/CompletionJsxProps.res 22:52
239262
posCursor:[22:52] posNoWhite:[22:51] Found expr:[22:12->22:52]

tests/analysis_tests/tests/src/expected/CompletionPipeChain.res.txt

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,15 @@ CPPipe pathFromEnv:CompletionSupport2.Internal found:false
423423
Path CompletionSupport2.Internal.support
424424
CPPipe pathFromEnv:CompletionSupport.Nested found:false
425425
Path CompletionSupport.Nested.root
426-
[]
426+
CPPipe pathFromEnv:ReactDOM.Client.Root found:false
427+
Path ReactDOM.Client.Root.ren
428+
[{
429+
"label": "ReactDOM.Client.Root.render",
430+
"kind": 12,
431+
"tags": [],
432+
"detail": "(t, React.element) => unit",
433+
"documentation": null
434+
}]
427435

428436
Complete src/CompletionPipeChain.res 88:16
429437
posCursor:[88:16] posNoWhite:[88:15] Found expr:[76:15->93:1]
@@ -440,7 +448,15 @@ Resolved opens 1 Stdlib
440448
ContextPath Value[root]->ren
441449
ContextPath Value[root]
442450
Path root
443-
[]
451+
CPPipe pathFromEnv:ReactDOM.Client.Root found:false
452+
Path ReactDOM.Client.Root.ren
453+
[{
454+
"label": "ReactDOM.Client.Root.render",
455+
"kind": 12,
456+
"tags": [],
457+
"detail": "(t, React.element) => unit",
458+
"documentation": null
459+
}]
444460

445461
Complete src/CompletionPipeChain.res 95:20
446462
posCursor:[95:20] posNoWhite:[95:19] Found expr:[95:3->95:21]

tests/analysis_tests/tests/src/expected/Div.res.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ Completable: Cjsx([div], dangerous, [dangerous])
88
Package opens Stdlib.place holder Pervasives.JsxModules.place holder
99
Resolved opens 1 Stdlib
1010
Path ReactDOM.domProps
11-
[completing-lowercase-jsx] could not find element props to complete from.
12-
[]
11+
Path JsxDOM.domProps
12+
[{
13+
"label": "dangerouslySetInnerHTML",
14+
"kind": 4,
15+
"tags": [],
16+
"detail": "{\"__html\": string}",
17+
"documentation": null
18+
}]
1319

tests/analysis_tests/tests/src/expected/Fragment.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Hover src/Fragment.res 6:19
2-
{"contents": {"kind": "markdown", "value": "```rescript\nReact.component<SectionHeader.props<React.element>>\n```\n\n---\n\n```\n \n```\n```rescript\ntype SectionHeader.props<'children> = {children: 'children}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Fragment.res%22%2C1%2C2%5D)\n"}}
2+
{"contents": {"kind": "markdown", "value": "```rescript\nReact.component<SectionHeader.props<React.element>>\n```\n\n---\n\n```\n \n```\n```rescript\ntype React.component<'props> = Jsx.component<'props>\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22React.res%22%2C12%2C0%5D)\n\n\n---\n\n```\n \n```\n```rescript\ntype SectionHeader.props<'children> = {children: 'children}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Fragment.res%22%2C1%2C2%5D)\n\n\n---\n\n```\n \n```\n```rescript\ntype React.element = Jsx.element\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22React.res%22%2C0%2C0%5D)\n"}}
33

44
Hover src/Fragment.res 9:56
55
Nothing at that position. Now trying to use completion.

tests/analysis_tests/tests/src/expected/Hover.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ Path Hover.
241241
}]
242242

243243
Hover src/Hover.res 197:4
244-
{"contents": {"kind": "markdown", "value": "```rescript\nCompV4.props<int, string> => React.element\n```\n\n---\n\n```\n \n```\n```rescript\ntype CompV4.props<'n, 's> = {n?: 'n, s: 's}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Hover.res%22%2C190%2C2%5D)\n"}}
244+
{"contents": {"kind": "markdown", "value": "```rescript\nCompV4.props<int, string> => React.element\n```\n\n---\n\n```\n \n```\n```rescript\ntype CompV4.props<'n, 's> = {n?: 'n, s: 's}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Hover.res%22%2C190%2C2%5D)\n\n\n---\n\n```\n \n```\n```rescript\ntype React.element = Jsx.element\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22React.res%22%2C0%2C0%5D)\n"}}
245245

246246
Hover src/Hover.res 202:16
247247
{"contents": {"kind": "markdown", "value": "```rescript\nuseR\n```\n\n---\n\n```\n \n```\n```rescript\ntype useR = {x: int, y: list<option<r<float>>>}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Hover.res%22%2C200%2C0%5D)\n\n\n---\n\n```\n \n```\n```rescript\ntype r<'a> = {i: 'a, f: float}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Hover.res%22%2C101%2C0%5D)\n"}}

tests/analysis_tests/tests/src/expected/Jsx2.res.txt

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,13 @@ Package opens Stdlib.place holder Pervasives.JsxModules.place holder
362362
Resolved opens 1 Stdlib
363363
ContextPath Type[React, e]
364364
Path React.e
365-
[]
365+
[{
366+
"label": "element",
367+
"kind": 22,
368+
"tags": [],
369+
"detail": "type element",
370+
"documentation": {"kind": "markdown", "value": "```rescript\ntype element = Jsx.element\n```"}
371+
}]
366372

367373
Complete src/Jsx2.res 96:20
368374
posCursor:[96:20] posNoWhite:[96:19] Found pattern:[96:7->99:6]
@@ -472,7 +478,17 @@ Package opens Stdlib.place holder Pervasives.JsxModules.place holder
472478
Resolved opens 1 Stdlib
473479
ContextPath CJsxPropValue [div] x
474480
Path ReactDOM.domProps
475-
[]
481+
Path JsxDOM.domProps
482+
[{
483+
"label": "\"\"",
484+
"kind": 12,
485+
"tags": [],
486+
"detail": "string",
487+
"documentation": null,
488+
"sortText": "A",
489+
"insertText": "{\"$0\"}",
490+
"insertTextFormat": 2
491+
}]
476492

477493
Complete src/Jsx2.res 150:21
478494
posCursor:[150:21] posNoWhite:[150:20] Found expr:[150:12->150:32]

tests/analysis_tests/tests/src/expected/Jsx2.resi.txt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ Package opens Stdlib.place holder Pervasives.JsxModules.place holder
1212
Resolved opens 1 Stdlib
1313
ContextPath Type[React, e]
1414
Path React.e
15-
[]
15+
[{
16+
"label": "element",
17+
"kind": 22,
18+
"tags": [],
19+
"detail": "type element",
20+
"documentation": {"kind": "markdown", "value": "```rescript\ntype element = Jsx.element\n```"}
21+
}]
1622

1723
Complete src/Jsx2.resi 10:18
1824
posCursor:[10:18] posNoWhite:[10:17] Found type:[10:11->10:18]
@@ -22,5 +28,11 @@ Package opens Stdlib.place holder Pervasives.JsxModules.place holder
2228
Resolved opens 1 Stdlib
2329
ContextPath Type[React, e]
2430
Path React.e
25-
[]
31+
[{
32+
"label": "element",
33+
"kind": 22,
34+
"tags": [],
35+
"detail": "type element",
36+
"documentation": {"kind": "markdown", "value": "```rescript\ntype element = Jsx.element\n```"}
37+
}]
2638

tests/analysis_tests/tests/src/expected/JsxV4.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Path M4.make
1717
}]
1818

1919
Hover src/JsxV4.res 14:9
20-
{"contents": {"kind": "markdown", "value": "```rescript\nReact.component<M4.props<string, string, string>>\n```\n\n---\n\n```\n \n```\n```rescript\ntype M4.props<'first, 'fun, 'second> = {\n first: 'first,\n fun?: 'fun,\n second?: 'second,\n}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22JsxV4.res%22%2C3%2C2%5D)\n\n---\n Doc Comment For M4 "}}
20+
{"contents": {"kind": "markdown", "value": "```rescript\nReact.component<M4.props<string, string, string>>\n```\n\n---\n\n```\n \n```\n```rescript\ntype React.component<'props> = Jsx.component<'props>\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22React.res%22%2C12%2C0%5D)\n\n\n---\n\n```\n \n```\n```rescript\ntype M4.props<'first, 'fun, 'second> = {\n first: 'first,\n fun?: 'fun,\n second?: 'second,\n}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22JsxV4.res%22%2C3%2C2%5D)\n\n---\n Doc Comment For M4 "}}
2121

2222
Create Interface src/JsxV4.res
2323
module M4: {

tests/analysis_tests/tests/src/expected/RecoveryOnProp.res.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ Path Res
2121
"tags": [],
2222
"detail": "module Result",
2323
"documentation": null
24+
}, {
25+
"label": "RescriptReactErrorBoundary",
26+
"kind": 9,
27+
"tags": [],
28+
"detail": "module RescriptReactErrorBoundary",
29+
"documentation": null,
30+
"data": {
31+
"modulePath": "RescriptReactErrorBoundary",
32+
"filePath": "src/RecoveryOnProp.res"
33+
}
2434
}, {
2535
"label": "RescriptTools",
2636
"kind": 9,

tests/dependencies/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* linguist-vendored

tests/dependencies/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.res.js
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "@tests/rescript-react",
3+
"private": true
4+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "@rescript/react",
3+
"jsx": {
4+
"version": 4,
5+
"mode": "classic"
6+
},
7+
"sources": { "dir": "src", "subdirs": true },
8+
"package-specs": { "module": "commonjs", "in-source": true },
9+
"suffix": ".res.js"
10+
}

0 commit comments

Comments
 (0)