File tree 10 files changed +303
-4
lines changed
10 files changed +303
-4
lines changed Original file line number Diff line number Diff line change @@ -17,10 +17,21 @@ type constructor = {
17
17
payload ?: constructorPayload ,
18
18
}
19
19
20
+ type rec typeInSignature = {
21
+ path : string ,
22
+ genericTypeParameters : array <typeInSignature >,
23
+ }
24
+
25
+ type signatureDetails = {
26
+ parameters : array <typeInSignature >,
27
+ returnType : typeInSignature ,
28
+ }
29
+
20
30
@tag ("kind" )
21
31
type detail =
22
32
| @as ("record" ) Record ({items : array <field >})
23
33
| @as ("variant" ) Variant ({items : array <constructor >})
34
+ | @as ("alias" ) Signature ({details : signatureDetails })
24
35
25
36
type source = {
26
37
filepath : string ,
@@ -38,6 +49,8 @@ type rec item =
38
49
name : string ,
39
50
deprecated ?: string ,
40
51
source : source ,
52
+ /** Additional documentation of signature, if available. */
53
+ detail ?: detail ,
41
54
})
42
55
| @as ("type" )
43
56
Type ({
@@ -89,4 +102,4 @@ type doc = {
89
102
/**
90
103
`decodeFromJson(json)` parse JSON generated from `restool doc` command
91
104
*/
92
- external decodeFromJson : Js . Json .t => doc = "%identity"
105
+ external decodeFromJson : JSON .t => doc = "%identity"
Original file line number Diff line number Diff line change @@ -16,10 +16,22 @@ type constructor = {
16
16
deprecated?: string,
17
17
payload?: constructorPayload,
18
18
}
19
+
20
+ type rec typeInSignature = {
21
+ path: string,
22
+ genericTypeParameters: array<typeInSignature>,
23
+ }
24
+
25
+ type signatureDetails = {
26
+ parameters: array<typeInSignature>,
27
+ returnType: typeInSignature,
28
+ }
29
+
19
30
@tag("kind")
20
31
type detail =
21
32
| @as("record") Record({items: array<field>})
22
33
| @as("variant") Variant({items: array<constructor>})
34
+ | @as("signature") Signature({details: signatureDetails})
23
35
24
36
type source = {
25
37
filepath: string,
@@ -37,6 +49,8 @@ type rec item =
37
49
name: string,
38
50
deprecated?: string,
39
51
source: source,
52
+ /** Additional documentation of signature, if available. */
53
+ detail?: detail,
40
54
})
41
55
| @as("type")
42
56
Type({
@@ -85,4 +99,4 @@ type doc = {
85
99
items: array<item>,
86
100
}
87
101
88
- let decodeFromJson: Js.Json .t => doc
102
+ let decodeFromJson: JSON .t => doc
Original file line number Diff line number Diff line change 30
30
"filepath" : " src/DocExtraction2.resi" ,
31
31
"line" : 7 ,
32
32
"col" : 1
33
+ },
34
+ "detail" :
35
+ {
36
+ "kind" : " signature" ,
37
+ "details" : {
38
+ "parameters" : [{
39
+ "path" : " unit"
40
+ }],
41
+ "returnType" : {
42
+ "path" : " t"
43
+ }
44
+ }
33
45
}
34
46
},
35
47
{
65
77
"filepath" : " src/DocExtraction2.resi" ,
66
78
"line" : 15 ,
67
79
"col" : 3
80
+ },
81
+ "detail" :
82
+ {
83
+ "kind" : " signature" ,
84
+ "details" : {
85
+ "parameters" : [{
86
+ "path" : " unit"
87
+ }],
88
+ "returnType" : {
89
+ "path" : " t"
90
+ }
91
+ }
68
92
}
69
93
}]
70
94
}]
Original file line number Diff line number Diff line change 30
30
"filepath" : " src/DocExtraction2.resi" ,
31
31
"line" : 7 ,
32
32
"col" : 1
33
+ },
34
+ "detail" :
35
+ {
36
+ "kind" : " signature" ,
37
+ "details" : {
38
+ "parameters" : [{
39
+ "path" : " unit"
40
+ }],
41
+ "returnType" : {
42
+ "path" : " t"
43
+ }
44
+ }
33
45
}
34
46
},
35
47
{
65
77
"filepath" : " src/DocExtraction2.resi" ,
66
78
"line" : 15 ,
67
79
"col" : 3
80
+ },
81
+ "detail" :
82
+ {
83
+ "kind" : " signature" ,
84
+ "details" : {
85
+ "parameters" : [{
86
+ "path" : " unit"
87
+ }],
88
+ "returnType" : {
89
+ "path" : " t"
90
+ }
91
+ }
68
92
}
69
93
}]
70
94
}]
Original file line number Diff line number Diff line change 45
45
"filepath" : " src/DocExtractionRes.res" ,
46
46
"line" : 17 ,
47
47
"col" : 5
48
+ },
49
+ "detail" :
50
+ {
51
+ "kind" : " signature" ,
52
+ "details" : {
53
+ "parameters" : [{
54
+ "path" : " string"
55
+ }],
56
+ "returnType" : {
57
+ "path" : " t"
58
+ }
59
+ }
48
60
}
49
61
},
50
62
{
57
69
"filepath" : " src/DocExtractionRes.res" ,
58
70
"line" : 23 ,
59
71
"col" : 5
72
+ },
73
+ "detail" :
74
+ {
75
+ "kind" : " signature" ,
76
+ "details" : {
77
+ "parameters" : [{
78
+ "path" : " t"
79
+ }],
80
+ "returnType" : {
81
+ "path" : " t"
82
+ }
83
+ }
60
84
}
61
85
},
62
86
{
69
93
"filepath" : " src/DocExtractionRes.res" ,
70
94
"line" : 26 ,
71
95
"col" : 5
96
+ },
97
+ "detail" :
98
+ {
99
+ "kind" : " signature" ,
100
+ "details" : {
101
+ "returnType" : {
102
+ "path" : " int"
103
+ }
104
+ }
72
105
}
73
106
},
74
107
{
184
217
"filepath" : " src/DocExtractionRes.res" ,
185
218
"line" : 49 ,
186
219
"col" : 7
220
+ },
221
+ "detail" :
222
+ {
223
+ "kind" : " signature" ,
224
+ "details" : {
225
+ "parameters" : [{
226
+ "path" : " SomeInnerModule.status"
227
+ }],
228
+ "returnType" : {
229
+ "path" : " bool"
230
+ }
231
+ }
187
232
}
188
233
},
189
234
{
268
313
"filepath" : " src/DocExtractionRes.res" ,
269
314
"line" : 71 ,
270
315
"col" : 3
316
+ },
317
+ "detail" :
318
+ {
319
+ "kind" : " signature" ,
320
+ "details" : {
321
+ "parameters" : [{
322
+ "path" : " unit"
323
+ }],
324
+ "returnType" : {
325
+ "path" : " t"
326
+ }
327
+ }
271
328
}
272
329
}]
273
330
},
304
361
"filepath" : " src/DocExtractionRes.res" ,
305
362
"line" : 109 ,
306
363
"col" : 3
364
+ },
365
+ "detail" :
366
+ {
367
+ "kind" : " signature" ,
368
+ "details" : {
369
+ "parameters" : [{
370
+ "path" : " t"
371
+ }],
372
+ "returnType" : {
373
+ "path" : " t"
374
+ }
375
+ }
307
376
}
308
377
}]
309
378
},
341
410
"filepath" : " src/DocExtractionRes.res" ,
342
411
"line" : 128 ,
343
412
"col" : 7
413
+ },
414
+ "detail" :
415
+ {
416
+ "kind" : " signature" ,
417
+ "details" : {
418
+ "parameters" : [{
419
+ "path" : " int"
420
+ }],
421
+ "returnType" : {
422
+ "path" : " int"
423
+ }
424
+ }
344
425
}
345
426
}]
346
427
},
365
446
"filepath" : " src/DocExtractionRes.res" ,
366
447
"line" : 132 ,
367
448
"col" : 3
449
+ },
450
+ "detail" :
451
+ {
452
+ "kind" : " signature" ,
453
+ "details" : {
454
+ "returnType" : {
455
+ "path" : " int"
456
+ }
457
+ }
368
458
}
369
459
}]
370
460
},
390
480
"filepath" : " src/DocExtractionRes.res" ,
391
481
"line" : 136 ,
392
482
"col" : 7
483
+ },
484
+ "detail" :
485
+ {
486
+ "kind" : " signature" ,
487
+ "details" : {
488
+ "returnType" : {
489
+ "path" : " int"
490
+ }
491
+ }
393
492
}
394
493
}]
395
494
},
426
525
"filepath" : " src/DocExtractionRes.res" ,
427
526
"line" : 141 ,
428
527
"col" : 9
528
+ },
529
+ "detail" :
530
+ {
531
+ "kind" : " signature" ,
532
+ "details" : {
533
+ "returnType" : {
534
+ "path" : " int"
535
+ }
536
+ }
429
537
}
430
538
}]
431
539
}]
Original file line number Diff line number Diff line change 29
29
"filepath" : " src/ModC.resi" ,
30
30
"line" : 5 ,
31
31
"col" : 3
32
+ },
33
+ "detail" :
34
+ {
35
+ "kind" : " signature" ,
36
+ "details" : {
37
+ "returnType" : {
38
+ "path" : " string"
39
+ }
40
+ }
32
41
}
33
42
}]
34
43
}]
Original file line number Diff line number Diff line change 29
29
"filepath" : " src/ModC.resi" ,
30
30
"line" : 5 ,
31
31
"col" : 3
32
+ },
33
+ "detail" :
34
+ {
35
+ "kind" : " signature" ,
36
+ "details" : {
37
+ "returnType" : {
38
+ "path" : " string"
39
+ }
40
+ }
32
41
}
33
42
}]
34
43
}]
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ Usage: rescript-tools [command]
14
14
15
15
Commands :
16
16
17
- doc Generate documentation
17
+ doc < file > Generate documentation
18
18
reanalyze Reanalyze
19
19
- v, -- version Print version
20
20
- h, -- help Print help| }
You can’t perform that action at this time.
0 commit comments