Source file toplevel_api_gen.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
[@@@ocaml.ppx.context
{
tool_name = "ppx_driver";
include_dirs = [];
load_path = [];
open_modules = [];
for_package = None;
debug = false;
use_threads = false;
use_vmthreads = false;
recursive_types = false;
principal = false;
transparent_modules = false;
unboxed_types = false;
unsafe_string = false;
cookies = [("library-name", "js_top_worker_rpc_def")]
}]
[@@@ocaml.text " IDL for talking to the toplevel webworker "]
open Rpc
open Idl
let sockpath = "/tmp/js_top_worker.sock"
open Merlin_kernel
module Location = Ocaml_parsing.Location
type lexing_position = Lexing.position =
{
pos_fname: string ;
pos_lnum: int ;
pos_bol: int ;
pos_cnum: int }[@@deriving rpcty]
include
struct
let _ = fun (_ : lexing_position) -> ()
let rec lexing_position_pos_fname : (_, lexing_position) Rpc.Types.field
=
{
Rpc.Types.fname = "pos_fname";
Rpc.Types.field = (let open Rpc.Types in Basic String);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.pos_fname);
Rpc.Types.fset = (fun v -> fun _s -> { _s with pos_fname = v })
}
and lexing_position_pos_lnum : (_, lexing_position) Rpc.Types.field =
{
Rpc.Types.fname = "pos_lnum";
Rpc.Types.field = (let open Rpc.Types in Basic Int);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.pos_lnum);
Rpc.Types.fset = (fun v -> fun _s -> { _s with pos_lnum = v })
}
and lexing_position_pos_bol : (_, lexing_position) Rpc.Types.field =
{
Rpc.Types.fname = "pos_bol";
Rpc.Types.field = (let open Rpc.Types in Basic Int);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.pos_bol);
Rpc.Types.fset = (fun v -> fun _s -> { _s with pos_bol = v })
}
and lexing_position_pos_cnum : (_, lexing_position) Rpc.Types.field =
{
Rpc.Types.fname = "pos_cnum";
Rpc.Types.field = (let open Rpc.Types in Basic Int);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.pos_cnum);
Rpc.Types.fset = (fun v -> fun _s -> { _s with pos_cnum = v })
}
and typ_of_lexing_position =
Rpc.Types.Struct
({
Rpc.Types.fields =
[Rpc.Types.BoxedField lexing_position_pos_fname;
Rpc.Types.BoxedField lexing_position_pos_lnum;
Rpc.Types.BoxedField lexing_position_pos_bol;
Rpc.Types.BoxedField lexing_position_pos_cnum];
Rpc.Types.sname = "lexing_position";
Rpc.Types.version = None;
Rpc.Types.constructor =
(fun getter ->
let open Rresult.R in
(getter.Rpc.Types.field_get "pos_cnum"
(let open Rpc.Types in Basic Int))
>>=
(fun lexing_position_pos_cnum ->
(getter.Rpc.Types.field_get "pos_bol"
(let open Rpc.Types in Basic Int))
>>=
(fun lexing_position_pos_bol ->
(getter.Rpc.Types.field_get "pos_lnum"
(let open Rpc.Types in Basic Int))
>>=
(fun lexing_position_pos_lnum ->
(getter.Rpc.Types.field_get "pos_fname"
(let open Rpc.Types in Basic String))
>>=
(fun lexing_position_pos_fname ->
return
{
pos_fname =
lexing_position_pos_fname;
pos_lnum = lexing_position_pos_lnum;
pos_bol = lexing_position_pos_bol;
pos_cnum = lexing_position_pos_cnum
})))))
} : lexing_position Rpc.Types.structure)
and lexing_position =
{
Rpc.Types.name = "lexing_position";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_lexing_position
}
let _ = lexing_position_pos_fname
and _ = lexing_position_pos_lnum
and _ = lexing_position_pos_bol
and _ = lexing_position_pos_cnum
and _ = typ_of_lexing_position
and _ = lexing_position
end[@@ocaml.doc "@inline"][@@merlin.hide ]
type location = Location.t =
{
loc_start: lexing_position ;
loc_end: lexing_position ;
loc_ghost: bool }[@@deriving rpcty]
include
struct
let _ = fun (_ : location) -> ()
let rec location_loc_start : (_, location) Rpc.Types.field =
{
Rpc.Types.fname = "loc_start";
Rpc.Types.field = typ_of_lexing_position;
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.loc_start);
Rpc.Types.fset = (fun v -> fun _s -> { _s with loc_start = v })
}
and location_loc_end : (_, location) Rpc.Types.field =
{
Rpc.Types.fname = "loc_end";
Rpc.Types.field = typ_of_lexing_position;
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.loc_end);
Rpc.Types.fset = (fun v -> fun _s -> { _s with loc_end = v })
}
and location_loc_ghost : (_, location) Rpc.Types.field =
{
Rpc.Types.fname = "loc_ghost";
Rpc.Types.field = (let open Rpc.Types in Basic Bool);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.loc_ghost);
Rpc.Types.fset = (fun v -> fun _s -> { _s with loc_ghost = v })
}
and typ_of_location =
Rpc.Types.Struct
({
Rpc.Types.fields =
[Rpc.Types.BoxedField location_loc_start;
Rpc.Types.BoxedField location_loc_end;
Rpc.Types.BoxedField location_loc_ghost];
Rpc.Types.sname = "location";
Rpc.Types.version = None;
Rpc.Types.constructor =
(fun getter ->
let open Rresult.R in
(getter.Rpc.Types.field_get "loc_ghost"
(let open Rpc.Types in Basic Bool))
>>=
(fun location_loc_ghost ->
(getter.Rpc.Types.field_get "loc_end"
typ_of_lexing_position)
>>=
(fun location_loc_end ->
(getter.Rpc.Types.field_get "loc_start"
typ_of_lexing_position)
>>=
(fun location_loc_start ->
return
{
loc_start = location_loc_start;
loc_end = location_loc_end;
loc_ghost = location_loc_ghost
}))))
} : location Rpc.Types.structure)
and location =
{
Rpc.Types.name = "location";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_location
}
let _ = location_loc_start
and _ = location_loc_end
and _ = location_loc_ghost
and _ = typ_of_location
and _ = location
end[@@ocaml.doc "@inline"][@@merlin.hide ]
type location_error_source = Location.error_source =
| Lexer
| Parser
| Typer
| Warning
| Unknown
| Env
| Config [@@deriving rpcty]
include
struct
let _ = fun (_ : location_error_source) -> ()
let rec typ_of_location_error_source =
Rpc.Types.Variant
({
Rpc.Types.vname = "location_error_source";
Rpc.Types.variants =
[BoxedTag
{
Rpc.Types.tname = "Lexer";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Lexer -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> Lexer))
};
BoxedTag
{
Rpc.Types.tname = "Parser";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Parser -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> Parser))
};
BoxedTag
{
Rpc.Types.tname = "Typer";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Typer -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> Typer))
};
BoxedTag
{
Rpc.Types.tname = "Warning";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Warning -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> Warning))
};
BoxedTag
{
Rpc.Types.tname = "Unknown";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Unknown -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> Unknown))
};
BoxedTag
{
Rpc.Types.tname = "Env";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Env -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> Env))
};
BoxedTag
{
Rpc.Types.tname = "Config";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Config -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> Config))
}];
Rpc.Types.vdefault = None;
Rpc.Types.vversion = None;
Rpc.Types.vconstructor =
(fun s' ->
fun t ->
let s = String.lowercase_ascii s' in
match s with
| "lexer" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok Lexer)
| "parser" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok Parser)
| "typer" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok Typer)
| "warning" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok Warning)
| "unknown" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok Unknown)
| "env" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok Env)
| "config" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok Config)
| _ ->
Rresult.R.error_msg
(Printf.sprintf "Unknown tag '%s'" s))
} : location_error_source Rpc.Types.variant)
and location_error_source =
{
Rpc.Types.name = "location_error_source";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_location_error_source
}
let _ = typ_of_location_error_source
and _ = location_error_source
end[@@ocaml.doc "@inline"][@@merlin.hide ]
type location_report_kind = Location.report_kind =
| Report_error
| Report_warning of string
| Report_warning_as_error of string
| Report_alert of string
| Report_alert_as_error of string [@@deriving rpcty]
include
struct
let _ = fun (_ : location_report_kind) -> ()
let rec typ_of_location_report_kind =
Rpc.Types.Variant
({
Rpc.Types.vname = "location_report_kind";
Rpc.Types.variants =
[BoxedTag
{
Rpc.Types.tname = "Report_error";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Report_error -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> Report_error))
};
BoxedTag
{
Rpc.Types.tname = "Report_warning";
Rpc.Types.tcontents = ((let open Rpc.Types in Basic String));
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Report_warning a0 -> Some a0 | _ -> None));
Rpc.Types.treview = ((function | a0 -> Report_warning a0))
};
BoxedTag
{
Rpc.Types.tname = "Report_warning_as_error";
Rpc.Types.tcontents = ((let open Rpc.Types in Basic String));
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function
| Report_warning_as_error a0 -> Some a0
| _ -> None));
Rpc.Types.treview =
((function | a0 -> Report_warning_as_error a0))
};
BoxedTag
{
Rpc.Types.tname = "Report_alert";
Rpc.Types.tcontents = ((let open Rpc.Types in Basic String));
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Report_alert a0 -> Some a0 | _ -> None));
Rpc.Types.treview = ((function | a0 -> Report_alert a0))
};
BoxedTag
{
Rpc.Types.tname = "Report_alert_as_error";
Rpc.Types.tcontents = ((let open Rpc.Types in Basic String));
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function
| Report_alert_as_error a0 -> Some a0
| _ -> None));
Rpc.Types.treview =
((function | a0 -> Report_alert_as_error a0))
}];
Rpc.Types.vdefault = None;
Rpc.Types.vversion = None;
Rpc.Types.vconstructor =
(fun s' ->
fun t ->
let s = String.lowercase_ascii s' in
match s with
| "report_error" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok Report_error)
| "report_warning" ->
Rresult.R.bind
(t.tget (let open Rpc.Types in Basic String))
(function | a0 -> Rresult.R.ok (Report_warning a0))
| "report_warning_as_error" ->
Rresult.R.bind
(t.tget (let open Rpc.Types in Basic String))
(function
| a0 -> Rresult.R.ok (Report_warning_as_error a0))
| "report_alert" ->
Rresult.R.bind
(t.tget (let open Rpc.Types in Basic String))
(function | a0 -> Rresult.R.ok (Report_alert a0))
| "report_alert_as_error" ->
Rresult.R.bind
(t.tget (let open Rpc.Types in Basic String))
(function
| a0 -> Rresult.R.ok (Report_alert_as_error a0))
| _ ->
Rresult.R.error_msg
(Printf.sprintf "Unknown tag '%s'" s))
} : location_report_kind Rpc.Types.variant)
and location_report_kind =
{
Rpc.Types.name = "location_report_kind";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_location_report_kind
}
let _ = typ_of_location_report_kind
and _ = location_report_kind
end[@@ocaml.doc "@inline"][@@merlin.hide ]
type source = string[@@deriving rpcty]
include
struct
let _ = fun (_ : source) -> ()
let rec typ_of_source = let open Rpc.Types in Basic String
and source =
{
Rpc.Types.name = "source";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_source
}
let _ = typ_of_source
and _ = source
end[@@ocaml.doc "@inline"][@@merlin.hide ]
[@@@ocaml.text
" CMIs are provided either statically or as URLs to be downloaded on demand "]
[@@@ocaml.text
" Dynamic cmis are loaded from beneath the given url. In addition the\n top-level modules are specified, and prefixes for other modules. For\n example, for the OCaml standard library, a user might pass:\n\n {[\n { dcs_url=\"/static/stdlib\";\n dcs_toplevel_modules=[\"Stdlib\"];\n dcs_file_prefixes=[\"stdlib__\"]; }\n ]}\n\n In which case, merlin will expect to be able to download a valid file\n from the url [\"/static/stdlib/stdlib.cmi\"] corresponding to the\n specified toplevel module, and it will also attempt to download any\n module with the prefix [\"Stdlib__\"] from the same base url, so for\n example if an attempt is made to look up the module [\"Stdlib__Foo\"]\n then merlin-js will attempt to download a file from the url\n [\"/static/stdlib/stdlib__Foo.cmi\"].\n "]
type dynamic_cmis =
{
dcs_url: string ;
dcs_toplevel_modules: string list ;
dcs_file_prefixes: string list }
and static_cmi = {
sc_name: string ;
sc_content: string }
and cmis = {
static_cmis: static_cmi list ;
dynamic_cmis: dynamic_cmis list }[@@deriving rpcty]
include
struct
let _ = fun (_ : dynamic_cmis) -> ()
let _ = fun (_ : static_cmi) -> ()
let _ = fun (_ : cmis) -> ()
let rec dynamic_cmis_dcs_url : (_, dynamic_cmis) Rpc.Types.field =
{
Rpc.Types.fname = "dcs_url";
Rpc.Types.field = (let open Rpc.Types in Basic String);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.dcs_url);
Rpc.Types.fset = (fun v -> fun _s -> { _s with dcs_url = v })
}
and dynamic_cmis_dcs_toplevel_modules : (_, dynamic_cmis) Rpc.Types.field
=
{
Rpc.Types.fname = "dcs_toplevel_modules";
Rpc.Types.field =
(Rpc.Types.List (let open Rpc.Types in Basic String));
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.dcs_toplevel_modules);
Rpc.Types.fset =
(fun v -> fun _s -> { _s with dcs_toplevel_modules = v })
}
and dynamic_cmis_dcs_file_prefixes : (_, dynamic_cmis) Rpc.Types.field =
{
Rpc.Types.fname = "dcs_file_prefixes";
Rpc.Types.field =
(Rpc.Types.List (let open Rpc.Types in Basic String));
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.dcs_file_prefixes);
Rpc.Types.fset =
(fun v -> fun _s -> { _s with dcs_file_prefixes = v })
}
and typ_of_dynamic_cmis =
Rpc.Types.Struct
({
Rpc.Types.fields =
[Rpc.Types.BoxedField dynamic_cmis_dcs_url;
Rpc.Types.BoxedField dynamic_cmis_dcs_toplevel_modules;
Rpc.Types.BoxedField dynamic_cmis_dcs_file_prefixes];
Rpc.Types.sname = "dynamic_cmis";
Rpc.Types.version = None;
Rpc.Types.constructor =
(fun getter ->
let open Rresult.R in
(getter.Rpc.Types.field_get "dcs_file_prefixes"
(Rpc.Types.List (let open Rpc.Types in Basic String)))
>>=
(fun dynamic_cmis_dcs_file_prefixes ->
(getter.Rpc.Types.field_get "dcs_toplevel_modules"
(Rpc.Types.List
(let open Rpc.Types in Basic String)))
>>=
(fun dynamic_cmis_dcs_toplevel_modules ->
(getter.Rpc.Types.field_get "dcs_url"
(let open Rpc.Types in Basic String))
>>=
(fun dynamic_cmis_dcs_url ->
return
{
dcs_url = dynamic_cmis_dcs_url;
dcs_toplevel_modules =
dynamic_cmis_dcs_toplevel_modules;
dcs_file_prefixes =
dynamic_cmis_dcs_file_prefixes
}))))
} : dynamic_cmis Rpc.Types.structure)
and dynamic_cmis =
{
Rpc.Types.name = "dynamic_cmis";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_dynamic_cmis
}
and static_cmi_sc_name : (_, static_cmi) Rpc.Types.field =
{
Rpc.Types.fname = "sc_name";
Rpc.Types.field = (let open Rpc.Types in Basic String);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.sc_name);
Rpc.Types.fset = (fun v -> fun _s -> { _s with sc_name = v })
}
and static_cmi_sc_content : (_, static_cmi) Rpc.Types.field =
{
Rpc.Types.fname = "sc_content";
Rpc.Types.field = (let open Rpc.Types in Basic String);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.sc_content);
Rpc.Types.fset = (fun v -> fun _s -> { _s with sc_content = v })
}
and typ_of_static_cmi =
Rpc.Types.Struct
({
Rpc.Types.fields =
[Rpc.Types.BoxedField static_cmi_sc_name;
Rpc.Types.BoxedField static_cmi_sc_content];
Rpc.Types.sname = "static_cmi";
Rpc.Types.version = None;
Rpc.Types.constructor =
(fun getter ->
let open Rresult.R in
(getter.Rpc.Types.field_get "sc_content"
(let open Rpc.Types in Basic String))
>>=
(fun static_cmi_sc_content ->
(getter.Rpc.Types.field_get "sc_name"
(let open Rpc.Types in Basic String))
>>=
(fun static_cmi_sc_name ->
return
{
sc_name = static_cmi_sc_name;
sc_content = static_cmi_sc_content
})))
} : static_cmi Rpc.Types.structure)
and static_cmi =
{
Rpc.Types.name = "static_cmi";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_static_cmi
}
and cmis_static_cmis : (_, cmis) Rpc.Types.field =
{
Rpc.Types.fname = "static_cmis";
Rpc.Types.field = (Rpc.Types.List typ_of_static_cmi);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.static_cmis);
Rpc.Types.fset = (fun v -> fun _s -> { _s with static_cmis = v })
}
and cmis_dynamic_cmis : (_, cmis) Rpc.Types.field =
{
Rpc.Types.fname = "dynamic_cmis";
Rpc.Types.field = (Rpc.Types.List typ_of_dynamic_cmis);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.dynamic_cmis);
Rpc.Types.fset = (fun v -> fun _s -> { _s with dynamic_cmis = v })
}
and typ_of_cmis =
Rpc.Types.Struct
({
Rpc.Types.fields =
[Rpc.Types.BoxedField cmis_static_cmis;
Rpc.Types.BoxedField cmis_dynamic_cmis];
Rpc.Types.sname = "cmis";
Rpc.Types.version = None;
Rpc.Types.constructor =
(fun getter ->
let open Rresult.R in
(getter.Rpc.Types.field_get "dynamic_cmis"
(Rpc.Types.List typ_of_dynamic_cmis))
>>=
(fun cmis_dynamic_cmis ->
(getter.Rpc.Types.field_get "static_cmis"
(Rpc.Types.List typ_of_static_cmi))
>>=
(fun cmis_static_cmis ->
return
{
static_cmis = cmis_static_cmis;
dynamic_cmis = cmis_dynamic_cmis
})))
} : cmis Rpc.Types.structure)
and cmis =
{
Rpc.Types.name = "cmis";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_cmis
}
let _ = dynamic_cmis_dcs_url
and _ = dynamic_cmis_dcs_toplevel_modules
and _ = dynamic_cmis_dcs_file_prefixes
and _ = typ_of_dynamic_cmis
and _ = dynamic_cmis
and _ = static_cmi_sc_name
and _ = static_cmi_sc_content
and _ = typ_of_static_cmi
and _ = static_cmi
and _ = cmis_static_cmis
and _ = cmis_dynamic_cmis
and _ = typ_of_cmis
and _ = cmis
end[@@ocaml.doc "@inline"][@@merlin.hide ]
type action =
| Complete_prefix of source * Msource.position
| Type_enclosing of source * Msource.position
| All_errors of source
| Add_cmis of cmis
type error =
{
kind: location_report_kind ;
loc: location ;
main: string ;
sub: string list ;
source: location_error_source }[@@deriving rpcty]
include
struct
let _ = fun (_ : error) -> ()
let rec error_kind : (_, error) Rpc.Types.field =
{
Rpc.Types.fname = "kind";
Rpc.Types.field = typ_of_location_report_kind;
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.kind);
Rpc.Types.fset = (fun v -> fun _s -> { _s with kind = v })
}
and error_loc : (_, error) Rpc.Types.field =
{
Rpc.Types.fname = "loc";
Rpc.Types.field = typ_of_location;
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.loc);
Rpc.Types.fset = (fun v -> fun _s -> { _s with loc = v })
}
and error_main : (_, error) Rpc.Types.field =
{
Rpc.Types.fname = "main";
Rpc.Types.field = (let open Rpc.Types in Basic String);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.main);
Rpc.Types.fset = (fun v -> fun _s -> { _s with main = v })
}
and error_sub : (_, error) Rpc.Types.field =
{
Rpc.Types.fname = "sub";
Rpc.Types.field =
(Rpc.Types.List (let open Rpc.Types in Basic String));
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.sub);
Rpc.Types.fset = (fun v -> fun _s -> { _s with sub = v })
}
and error_source : (_, error) Rpc.Types.field =
{
Rpc.Types.fname = "source";
Rpc.Types.field = typ_of_location_error_source;
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.source);
Rpc.Types.fset = (fun v -> fun _s -> { _s with source = v })
}
and typ_of_error =
Rpc.Types.Struct
({
Rpc.Types.fields =
[Rpc.Types.BoxedField error_kind;
Rpc.Types.BoxedField error_loc;
Rpc.Types.BoxedField error_main;
Rpc.Types.BoxedField error_sub;
Rpc.Types.BoxedField error_source];
Rpc.Types.sname = "error";
Rpc.Types.version = None;
Rpc.Types.constructor =
(fun getter ->
let open Rresult.R in
(getter.Rpc.Types.field_get "source"
typ_of_location_error_source)
>>=
(fun error_source ->
(getter.Rpc.Types.field_get "sub"
(Rpc.Types.List
(let open Rpc.Types in Basic String)))
>>=
(fun error_sub ->
(getter.Rpc.Types.field_get "main"
(let open Rpc.Types in Basic String))
>>=
(fun error_main ->
(getter.Rpc.Types.field_get "loc"
typ_of_location)
>>=
(fun error_loc ->
(getter.Rpc.Types.field_get "kind"
typ_of_location_report_kind)
>>=
(fun error_kind ->
return
{
kind = error_kind;
loc = error_loc;
main = error_main;
sub = error_sub;
source = error_source
}))))))
} : error Rpc.Types.structure)
and error =
{
Rpc.Types.name = "error";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_error
}
let _ = error_kind
and _ = error_loc
and _ = error_main
and _ = error_sub
and _ = error_source
and _ = typ_of_error
and _ = error
end[@@ocaml.doc "@inline"][@@merlin.hide ]
type error_list = error list[@@deriving rpcty]
include
struct
let _ = fun (_ : error_list) -> ()
let rec typ_of_error_list = Rpc.Types.List typ_of_error
and error_list =
{
Rpc.Types.name = "error_list";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_error_list
}
let _ = typ_of_error_list
and _ = error_list
end[@@ocaml.doc "@inline"][@@merlin.hide ]
type kind_ty =
| Constructor
| Keyword
| Label
| MethodCall
| Modtype
| Module
| Type
| Value
| Variant [@@deriving rpcty]
include
struct
let _ = fun (_ : kind_ty) -> ()
let rec typ_of_kind_ty =
Rpc.Types.Variant
({
Rpc.Types.vname = "kind_ty";
Rpc.Types.variants =
[BoxedTag
{
Rpc.Types.tname = "Constructor";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Constructor -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> Constructor))
};
BoxedTag
{
Rpc.Types.tname = "Keyword";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Keyword -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> Keyword))
};
BoxedTag
{
Rpc.Types.tname = "Label";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Label -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> Label))
};
BoxedTag
{
Rpc.Types.tname = "MethodCall";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | MethodCall -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> MethodCall))
};
BoxedTag
{
Rpc.Types.tname = "Modtype";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Modtype -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> Modtype))
};
BoxedTag
{
Rpc.Types.tname = "Module";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Module -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> Module))
};
BoxedTag
{
Rpc.Types.tname = "Type";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Type -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> Type))
};
BoxedTag
{
Rpc.Types.tname = "Value";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Value -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> Value))
};
BoxedTag
{
Rpc.Types.tname = "Variant";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Variant -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> Variant))
}];
Rpc.Types.vdefault = None;
Rpc.Types.vversion = None;
Rpc.Types.vconstructor =
(fun s' ->
fun t ->
let s = String.lowercase_ascii s' in
match s with
| "constructor" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok Constructor)
| "keyword" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok Keyword)
| "label" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok Label)
| "methodcall" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok MethodCall)
| "modtype" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok Modtype)
| "module" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok Module)
| "type" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok Type)
| "value" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok Value)
| "variant" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok Variant)
| _ ->
Rresult.R.error_msg
(Printf.sprintf "Unknown tag '%s'" s))
} : kind_ty Rpc.Types.variant)
and kind_ty =
{
Rpc.Types.name = "kind_ty";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_kind_ty
}
let _ = typ_of_kind_ty
and _ = kind_ty
end[@@ocaml.doc "@inline"][@@merlin.hide ]
type query_protocol_compl_entry =
{
name: string ;
kind: kind_ty ;
desc: string ;
info: string ;
deprecated: bool }[@@deriving rpcty]
include
struct
let _ = fun (_ : query_protocol_compl_entry) -> ()
let rec query_protocol_compl_entry_name :
(_, query_protocol_compl_entry) Rpc.Types.field =
{
Rpc.Types.fname = "name";
Rpc.Types.field = (let open Rpc.Types in Basic String);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.name);
Rpc.Types.fset = (fun v -> fun _s -> { _s with name = v })
}
and query_protocol_compl_entry_kind :
(_, query_protocol_compl_entry) Rpc.Types.field =
{
Rpc.Types.fname = "kind";
Rpc.Types.field = typ_of_kind_ty;
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.kind);
Rpc.Types.fset = (fun v -> fun _s -> { _s with kind = v })
}
and query_protocol_compl_entry_desc :
(_, query_protocol_compl_entry) Rpc.Types.field =
{
Rpc.Types.fname = "desc";
Rpc.Types.field = (let open Rpc.Types in Basic String);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.desc);
Rpc.Types.fset = (fun v -> fun _s -> { _s with desc = v })
}
and query_protocol_compl_entry_info :
(_, query_protocol_compl_entry) Rpc.Types.field =
{
Rpc.Types.fname = "info";
Rpc.Types.field = (let open Rpc.Types in Basic String);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.info);
Rpc.Types.fset = (fun v -> fun _s -> { _s with info = v })
}
and query_protocol_compl_entry_deprecated :
(_, query_protocol_compl_entry) Rpc.Types.field =
{
Rpc.Types.fname = "deprecated";
Rpc.Types.field = (let open Rpc.Types in Basic Bool);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.deprecated);
Rpc.Types.fset = (fun v -> fun _s -> { _s with deprecated = v })
}
and typ_of_query_protocol_compl_entry =
Rpc.Types.Struct
({
Rpc.Types.fields =
[Rpc.Types.BoxedField query_protocol_compl_entry_name;
Rpc.Types.BoxedField query_protocol_compl_entry_kind;
Rpc.Types.BoxedField query_protocol_compl_entry_desc;
Rpc.Types.BoxedField query_protocol_compl_entry_info;
Rpc.Types.BoxedField query_protocol_compl_entry_deprecated];
Rpc.Types.sname = "query_protocol_compl_entry";
Rpc.Types.version = None;
Rpc.Types.constructor =
(fun getter ->
let open Rresult.R in
(getter.Rpc.Types.field_get "deprecated"
(let open Rpc.Types in Basic Bool))
>>=
(fun query_protocol_compl_entry_deprecated ->
(getter.Rpc.Types.field_get "info"
(let open Rpc.Types in Basic String))
>>=
(fun query_protocol_compl_entry_info ->
(getter.Rpc.Types.field_get "desc"
(let open Rpc.Types in Basic String))
>>=
(fun query_protocol_compl_entry_desc ->
(getter.Rpc.Types.field_get "kind"
typ_of_kind_ty)
>>=
(fun query_protocol_compl_entry_kind ->
(getter.Rpc.Types.field_get "name"
(let open Rpc.Types in Basic String))
>>=
(fun query_protocol_compl_entry_name
->
return
{
name =
query_protocol_compl_entry_name;
kind =
query_protocol_compl_entry_kind;
desc =
query_protocol_compl_entry_desc;
info =
query_protocol_compl_entry_info;
deprecated =
query_protocol_compl_entry_deprecated
}))))))
} : query_protocol_compl_entry Rpc.Types.structure)
and query_protocol_compl_entry =
{
Rpc.Types.name = "query_protocol_compl_entry";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_query_protocol_compl_entry
}
let _ = query_protocol_compl_entry_name
and _ = query_protocol_compl_entry_kind
and _ = query_protocol_compl_entry_desc
and _ = query_protocol_compl_entry_info
and _ = query_protocol_compl_entry_deprecated
and _ = typ_of_query_protocol_compl_entry
and _ = query_protocol_compl_entry
end[@@ocaml.doc "@inline"][@@merlin.hide ]
type completions =
{
from: int ;
to_: int ;
entries: query_protocol_compl_entry list }[@@deriving rpcty]
include
struct
let _ = fun (_ : completions) -> ()
let rec completions_from : (_, completions) Rpc.Types.field =
{
Rpc.Types.fname = "from";
Rpc.Types.field = (let open Rpc.Types in Basic Int);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.from);
Rpc.Types.fset = (fun v -> fun _s -> { _s with from = v })
}
and completions_to_ : (_, completions) Rpc.Types.field =
{
Rpc.Types.fname = "to_";
Rpc.Types.field = (let open Rpc.Types in Basic Int);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.to_);
Rpc.Types.fset = (fun v -> fun _s -> { _s with to_ = v })
}
and completions_entries : (_, completions) Rpc.Types.field =
{
Rpc.Types.fname = "entries";
Rpc.Types.field = (Rpc.Types.List typ_of_query_protocol_compl_entry);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.entries);
Rpc.Types.fset = (fun v -> fun _s -> { _s with entries = v })
}
and typ_of_completions =
Rpc.Types.Struct
({
Rpc.Types.fields =
[Rpc.Types.BoxedField completions_from;
Rpc.Types.BoxedField completions_to_;
Rpc.Types.BoxedField completions_entries];
Rpc.Types.sname = "completions";
Rpc.Types.version = None;
Rpc.Types.constructor =
(fun getter ->
let open Rresult.R in
(getter.Rpc.Types.field_get "entries"
(Rpc.Types.List typ_of_query_protocol_compl_entry))
>>=
(fun completions_entries ->
(getter.Rpc.Types.field_get "to_"
(let open Rpc.Types in Basic Int))
>>=
(fun completions_to_ ->
(getter.Rpc.Types.field_get "from"
(let open Rpc.Types in Basic Int))
>>=
(fun completions_from ->
return
{
from = completions_from;
to_ = completions_to_;
entries = completions_entries
}))))
} : completions Rpc.Types.structure)
and completions =
{
Rpc.Types.name = "completions";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_completions
}
let _ = completions_from
and _ = completions_to_
and _ = completions_entries
and _ = typ_of_completions
and _ = completions
end[@@ocaml.doc "@inline"][@@merlin.hide ]
type msource_position =
| Start
| Offset of int
| Logical of int * int
| End [@@deriving rpcty]
include
struct
let _ = fun (_ : msource_position) -> ()
let rec typ_of_msource_position =
Rpc.Types.Variant
({
Rpc.Types.vname = "msource_position";
Rpc.Types.variants =
[BoxedTag
{
Rpc.Types.tname = "Start";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Start -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> Start))
};
BoxedTag
{
Rpc.Types.tname = "Offset";
Rpc.Types.tcontents = ((let open Rpc.Types in Basic Int));
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Offset a0 -> Some a0 | _ -> None));
Rpc.Types.treview = ((function | a0 -> Offset a0))
};
BoxedTag
{
Rpc.Types.tname = "Logical";
Rpc.Types.tcontents =
(Tuple
(((let open Rpc.Types in Basic Int)),
((let open Rpc.Types in Basic Int))));
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Logical (a0, a1) -> Some (a0, a1) | _ -> None));
Rpc.Types.treview =
((function | (a0, a1) -> Logical (a0, a1)))
};
BoxedTag
{
Rpc.Types.tname = "End";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | End -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> End))
}];
Rpc.Types.vdefault = None;
Rpc.Types.vversion = None;
Rpc.Types.vconstructor =
(fun s' ->
fun t ->
let s = String.lowercase_ascii s' in
match s with
| "start" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok Start)
| "offset" ->
Rresult.R.bind
(t.tget (let open Rpc.Types in Basic Int))
(function | a0 -> Rresult.R.ok (Offset a0))
| "logical" ->
Rresult.R.bind
(t.tget
(Tuple
((let open Rpc.Types in Basic Int),
(let open Rpc.Types in Basic Int))))
(function
| (a0, a1) -> Rresult.R.ok (Logical (a0, a1)))
| "end" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok End)
| _ ->
Rresult.R.error_msg
(Printf.sprintf "Unknown tag '%s'" s))
} : msource_position Rpc.Types.variant)
and msource_position =
{
Rpc.Types.name = "msource_position";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_msource_position
}
let _ = typ_of_msource_position
and _ = msource_position
end[@@ocaml.doc "@inline"][@@merlin.hide ]
type is_tail_position =
| No
| Tail_position
| Tail_call [@@deriving rpcty]
include
struct
let _ = fun (_ : is_tail_position) -> ()
let rec typ_of_is_tail_position =
Rpc.Types.Variant
({
Rpc.Types.vname = "is_tail_position";
Rpc.Types.variants =
[BoxedTag
{
Rpc.Types.tname = "No";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | No -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> No))
};
BoxedTag
{
Rpc.Types.tname = "Tail_position";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Tail_position -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> Tail_position))
};
BoxedTag
{
Rpc.Types.tname = "Tail_call";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Tail_call -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> Tail_call))
}];
Rpc.Types.vdefault = None;
Rpc.Types.vversion = None;
Rpc.Types.vconstructor =
(fun s' ->
fun t ->
let s = String.lowercase_ascii s' in
match s with
| "no" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok No)
| "tail_position" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok Tail_position)
| "tail_call" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok Tail_call)
| _ ->
Rresult.R.error_msg
(Printf.sprintf "Unknown tag '%s'" s))
} : is_tail_position Rpc.Types.variant)
and is_tail_position =
{
Rpc.Types.name = "is_tail_position";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_is_tail_position
}
let _ = typ_of_is_tail_position
and _ = is_tail_position
end[@@ocaml.doc "@inline"][@@merlin.hide ]
type index_or_string =
| Index of int
| String of string [@@deriving rpcty]
include
struct
let _ = fun (_ : index_or_string) -> ()
let rec typ_of_index_or_string =
Rpc.Types.Variant
({
Rpc.Types.vname = "index_or_string";
Rpc.Types.variants =
[BoxedTag
{
Rpc.Types.tname = "Index";
Rpc.Types.tcontents = ((let open Rpc.Types in Basic Int));
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Index a0 -> Some a0 | _ -> None));
Rpc.Types.treview = ((function | a0 -> Index a0))
};
BoxedTag
{
Rpc.Types.tname = "String";
Rpc.Types.tcontents = ((let open Rpc.Types in Basic String));
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | String a0 -> Some a0 | _ -> None));
Rpc.Types.treview = ((function | a0 -> String a0))
}];
Rpc.Types.vdefault = None;
Rpc.Types.vversion = None;
Rpc.Types.vconstructor =
(fun s' ->
fun t ->
let s = String.lowercase_ascii s' in
match s with
| "index" ->
Rresult.R.bind
(t.tget (let open Rpc.Types in Basic Int))
(function | a0 -> Rresult.R.ok (Index a0))
| "string" ->
Rresult.R.bind
(t.tget (let open Rpc.Types in Basic String))
(function | a0 -> Rresult.R.ok (String a0))
| _ ->
Rresult.R.error_msg
(Printf.sprintf "Unknown tag '%s'" s))
} : index_or_string Rpc.Types.variant)
and index_or_string =
{
Rpc.Types.name = "index_or_string";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_index_or_string
}
let _ = typ_of_index_or_string
and _ = index_or_string
end[@@ocaml.doc "@inline"][@@merlin.hide ]
type typed_enclosings = (location * index_or_string * is_tail_position)
[@@deriving rpcty]
include
struct
let _ = fun (_ : typed_enclosings) -> ()
let rec typ_of_typed_enclosings =
Rpc.Types.Tuple3
(typ_of_location, typ_of_index_or_string, typ_of_is_tail_position)
and typed_enclosings =
{
Rpc.Types.name = "typed_enclosings";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_typed_enclosings
}
let _ = typ_of_typed_enclosings
and _ = typed_enclosings
end[@@ocaml.doc "@inline"][@@merlin.hide ]
type typed_enclosings_list = typed_enclosings list[@@deriving rpcty]
include
struct
let _ = fun (_ : typed_enclosings_list) -> ()
let rec typ_of_typed_enclosings_list =
Rpc.Types.List typ_of_typed_enclosings
and typed_enclosings_list =
{
Rpc.Types.name = "typed_enclosings_list";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_typed_enclosings_list
}
let _ = typ_of_typed_enclosings_list
and _ = typed_enclosings_list
end[@@ocaml.doc "@inline"][@@merlin.hide ]
let report_source_to_string =
function
| Location.Lexer -> "lexer"
| Location.Parser -> "parser"
| Location.Typer -> "typer"
| Location.Warning -> "warning"
| Location.Unknown -> "unknown"
| Location.Env -> "env"
| Location.Config -> "config"
type highlight = {
line1: int ;
line2: int ;
col1: int ;
col2: int }[@@deriving rpcty][@@ocaml.doc " An area to be highlighted "]
include
struct
let _ = fun (_ : highlight) -> ()
let rec highlight_line1 : (_, highlight) Rpc.Types.field =
{
Rpc.Types.fname = "line1";
Rpc.Types.field = (let open Rpc.Types in Basic Int);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.line1);
Rpc.Types.fset = (fun v -> fun _s -> { _s with line1 = v })
}
and highlight_line2 : (_, highlight) Rpc.Types.field =
{
Rpc.Types.fname = "line2";
Rpc.Types.field = (let open Rpc.Types in Basic Int);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.line2);
Rpc.Types.fset = (fun v -> fun _s -> { _s with line2 = v })
}
and highlight_col1 : (_, highlight) Rpc.Types.field =
{
Rpc.Types.fname = "col1";
Rpc.Types.field = (let open Rpc.Types in Basic Int);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.col1);
Rpc.Types.fset = (fun v -> fun _s -> { _s with col1 = v })
}
and highlight_col2 : (_, highlight) Rpc.Types.field =
{
Rpc.Types.fname = "col2";
Rpc.Types.field = (let open Rpc.Types in Basic Int);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.col2);
Rpc.Types.fset = (fun v -> fun _s -> { _s with col2 = v })
}
and typ_of_highlight =
Rpc.Types.Struct
({
Rpc.Types.fields =
[Rpc.Types.BoxedField highlight_line1;
Rpc.Types.BoxedField highlight_line2;
Rpc.Types.BoxedField highlight_col1;
Rpc.Types.BoxedField highlight_col2];
Rpc.Types.sname = "highlight";
Rpc.Types.version = None;
Rpc.Types.constructor =
(fun getter ->
let open Rresult.R in
(getter.Rpc.Types.field_get "col2"
(let open Rpc.Types in Basic Int))
>>=
(fun highlight_col2 ->
(getter.Rpc.Types.field_get "col1"
(let open Rpc.Types in Basic Int))
>>=
(fun highlight_col1 ->
(getter.Rpc.Types.field_get "line2"
(let open Rpc.Types in Basic Int))
>>=
(fun highlight_line2 ->
(getter.Rpc.Types.field_get "line1"
(let open Rpc.Types in Basic Int))
>>=
(fun highlight_line1 ->
return
{
line1 = highlight_line1;
line2 = highlight_line2;
col1 = highlight_col1;
col2 = highlight_col2
})))))
} : highlight Rpc.Types.structure)
and highlight =
{
Rpc.Types.name = "highlight";
Rpc.Types.description = ["An area to be highlighted"];
Rpc.Types.ty = typ_of_highlight
}
let _ = highlight_line1
and _ = highlight_line2
and _ = highlight_col1
and _ = highlight_col2
and _ = typ_of_highlight
and _ = highlight
end[@@ocaml.doc "@inline"][@@merlin.hide ]
type encoding = Mime_printer.encoding =
| Noencoding
| Base64 [@@ocaml.doc " An area to be highlighted "][@@deriving rpcty]
include
struct
let _ = fun (_ : encoding) -> ()
let rec typ_of_encoding =
Rpc.Types.Variant
({
Rpc.Types.vname = "encoding";
Rpc.Types.variants =
[BoxedTag
{
Rpc.Types.tname = "Noencoding";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Noencoding -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> Noencoding))
};
BoxedTag
{
Rpc.Types.tname = "Base64";
Rpc.Types.tcontents = Unit;
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | Base64 -> Some () | _ -> None));
Rpc.Types.treview = ((function | () -> Base64))
}];
Rpc.Types.vdefault = None;
Rpc.Types.vversion = None;
Rpc.Types.vconstructor =
(fun s' ->
fun t ->
let s = String.lowercase_ascii s' in
match s with
| "noencoding" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok Noencoding)
| "base64" ->
Rresult.R.bind (t.tget Unit)
(function | () -> Rresult.R.ok Base64)
| _ ->
Rresult.R.error_msg
(Printf.sprintf "Unknown tag '%s'" s))
} : encoding Rpc.Types.variant)
and encoding =
{
Rpc.Types.name = "encoding";
Rpc.Types.description = ["An area to be highlighted"];
Rpc.Types.ty = typ_of_encoding
}
let _ = typ_of_encoding
and _ = encoding
end[@@ocaml.doc "@inline"][@@merlin.hide ]
type mime_val = Mime_printer.t =
{
mime_type: string ;
encoding: encoding ;
data: string }[@@deriving rpcty]
include
struct
let _ = fun (_ : mime_val) -> ()
let rec mime_val_mime_type : (_, mime_val) Rpc.Types.field =
{
Rpc.Types.fname = "mime_type";
Rpc.Types.field = (let open Rpc.Types in Basic String);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.mime_type);
Rpc.Types.fset = (fun v -> fun _s -> { _s with mime_type = v })
}
and mime_val_encoding : (_, mime_val) Rpc.Types.field =
{
Rpc.Types.fname = "encoding";
Rpc.Types.field = typ_of_encoding;
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.encoding);
Rpc.Types.fset = (fun v -> fun _s -> { _s with encoding = v })
}
and mime_val_data : (_, mime_val) Rpc.Types.field =
{
Rpc.Types.fname = "data";
Rpc.Types.field = (let open Rpc.Types in Basic String);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.data);
Rpc.Types.fset = (fun v -> fun _s -> { _s with data = v })
}
and typ_of_mime_val =
Rpc.Types.Struct
({
Rpc.Types.fields =
[Rpc.Types.BoxedField mime_val_mime_type;
Rpc.Types.BoxedField mime_val_encoding;
Rpc.Types.BoxedField mime_val_data];
Rpc.Types.sname = "mime_val";
Rpc.Types.version = None;
Rpc.Types.constructor =
(fun getter ->
let open Rresult.R in
(getter.Rpc.Types.field_get "data"
(let open Rpc.Types in Basic String))
>>=
(fun mime_val_data ->
(getter.Rpc.Types.field_get "encoding" typ_of_encoding)
>>=
(fun mime_val_encoding ->
(getter.Rpc.Types.field_get "mime_type"
(let open Rpc.Types in Basic String))
>>=
(fun mime_val_mime_type ->
return
{
mime_type = mime_val_mime_type;
encoding = mime_val_encoding;
data = mime_val_data
}))))
} : mime_val Rpc.Types.structure)
and mime_val =
{
Rpc.Types.name = "mime_val";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_mime_val
}
let _ = mime_val_mime_type
and _ = mime_val_encoding
and _ = mime_val_data
and _ = typ_of_mime_val
and _ = mime_val
end[@@ocaml.doc "@inline"][@@merlin.hide ]
type exec_result =
{
stdout: string option ;
stderr: string option ;
sharp_ppf: string option ;
caml_ppf: string option ;
highlight: highlight option ;
mime_vals: mime_val list }[@@deriving rpcty][@@ocaml.doc
" Represents the result of executing a toplevel phrase "]
include
struct
let _ = fun (_ : exec_result) -> ()
let rec exec_result_stdout : (_, exec_result) Rpc.Types.field =
{
Rpc.Types.fname = "stdout";
Rpc.Types.field =
(Rpc.Types.Option (let open Rpc.Types in Basic String));
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.stdout);
Rpc.Types.fset = (fun v -> fun _s -> { _s with stdout = v })
}
and exec_result_stderr : (_, exec_result) Rpc.Types.field =
{
Rpc.Types.fname = "stderr";
Rpc.Types.field =
(Rpc.Types.Option (let open Rpc.Types in Basic String));
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.stderr);
Rpc.Types.fset = (fun v -> fun _s -> { _s with stderr = v })
}
and exec_result_sharp_ppf : (_, exec_result) Rpc.Types.field =
{
Rpc.Types.fname = "sharp_ppf";
Rpc.Types.field =
(Rpc.Types.Option (let open Rpc.Types in Basic String));
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.sharp_ppf);
Rpc.Types.fset = (fun v -> fun _s -> { _s with sharp_ppf = v })
}
and exec_result_caml_ppf : (_, exec_result) Rpc.Types.field =
{
Rpc.Types.fname = "caml_ppf";
Rpc.Types.field =
(Rpc.Types.Option (let open Rpc.Types in Basic String));
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.caml_ppf);
Rpc.Types.fset = (fun v -> fun _s -> { _s with caml_ppf = v })
}
and exec_result_highlight : (_, exec_result) Rpc.Types.field =
{
Rpc.Types.fname = "highlight";
Rpc.Types.field = (Rpc.Types.Option typ_of_highlight);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.highlight);
Rpc.Types.fset = (fun v -> fun _s -> { _s with highlight = v })
}
and exec_result_mime_vals : (_, exec_result) Rpc.Types.field =
{
Rpc.Types.fname = "mime_vals";
Rpc.Types.field = (Rpc.Types.List typ_of_mime_val);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.mime_vals);
Rpc.Types.fset = (fun v -> fun _s -> { _s with mime_vals = v })
}
and typ_of_exec_result =
Rpc.Types.Struct
({
Rpc.Types.fields =
[Rpc.Types.BoxedField exec_result_stdout;
Rpc.Types.BoxedField exec_result_stderr;
Rpc.Types.BoxedField exec_result_sharp_ppf;
Rpc.Types.BoxedField exec_result_caml_ppf;
Rpc.Types.BoxedField exec_result_highlight;
Rpc.Types.BoxedField exec_result_mime_vals];
Rpc.Types.sname = "exec_result";
Rpc.Types.version = None;
Rpc.Types.constructor =
(fun getter ->
let open Rresult.R in
(getter.Rpc.Types.field_get "mime_vals"
(Rpc.Types.List typ_of_mime_val))
>>=
(fun exec_result_mime_vals ->
(getter.Rpc.Types.field_get "highlight"
(Rpc.Types.Option typ_of_highlight))
>>=
(fun exec_result_highlight ->
(getter.Rpc.Types.field_get "caml_ppf"
(Rpc.Types.Option
(let open Rpc.Types in Basic String)))
>>=
(fun exec_result_caml_ppf ->
(getter.Rpc.Types.field_get "sharp_ppf"
(Rpc.Types.Option
(let open Rpc.Types in Basic String)))
>>=
(fun exec_result_sharp_ppf ->
(getter.Rpc.Types.field_get "stderr"
(Rpc.Types.Option
(let open Rpc.Types in
Basic String)))
>>=
(fun exec_result_stderr ->
(getter.Rpc.Types.field_get
"stdout"
(Rpc.Types.Option
(let open Rpc.Types in
Basic String)))
>>=
(fun exec_result_stdout ->
return
{
stdout =
exec_result_stdout;
stderr =
exec_result_stderr;
sharp_ppf =
exec_result_sharp_ppf;
caml_ppf =
exec_result_caml_ppf;
highlight =
exec_result_highlight;
mime_vals =
exec_result_mime_vals
})))))))
} : exec_result Rpc.Types.structure)
and exec_result =
{
Rpc.Types.name = "exec_result";
Rpc.Types.description =
["Represents the result of executing a toplevel phrase"];
Rpc.Types.ty = typ_of_exec_result
}
let _ = exec_result_stdout
and _ = exec_result_stderr
and _ = exec_result_sharp_ppf
and _ = exec_result_caml_ppf
and _ = exec_result_highlight
and _ = exec_result_mime_vals
and _ = typ_of_exec_result
and _ = exec_result
end[@@ocaml.doc "@inline"][@@merlin.hide ]
type exec_toplevel_result = {
script: string ;
mime_vals: mime_val list }[@@deriving rpcty][@@ocaml.doc
" Represents the result of executing a toplevel script "]
include
struct
let _ = fun (_ : exec_toplevel_result) -> ()
let rec exec_toplevel_result_script :
(_, exec_toplevel_result) Rpc.Types.field =
{
Rpc.Types.fname = "script";
Rpc.Types.field = (let open Rpc.Types in Basic String);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.script);
Rpc.Types.fset = (fun v -> fun _s -> { _s with script = v })
}
and exec_toplevel_result_mime_vals :
(_, exec_toplevel_result) Rpc.Types.field =
{
Rpc.Types.fname = "mime_vals";
Rpc.Types.field = (Rpc.Types.List typ_of_mime_val);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.mime_vals);
Rpc.Types.fset = (fun v -> fun _s -> { _s with mime_vals = v })
}
and typ_of_exec_toplevel_result =
Rpc.Types.Struct
({
Rpc.Types.fields =
[Rpc.Types.BoxedField exec_toplevel_result_script;
Rpc.Types.BoxedField exec_toplevel_result_mime_vals];
Rpc.Types.sname = "exec_toplevel_result";
Rpc.Types.version = None;
Rpc.Types.constructor =
(fun getter ->
let open Rresult.R in
(getter.Rpc.Types.field_get "mime_vals"
(Rpc.Types.List typ_of_mime_val))
>>=
(fun exec_toplevel_result_mime_vals ->
(getter.Rpc.Types.field_get "script"
(let open Rpc.Types in Basic String))
>>=
(fun exec_toplevel_result_script ->
return
{
script = exec_toplevel_result_script;
mime_vals = exec_toplevel_result_mime_vals
})))
} : exec_toplevel_result Rpc.Types.structure)
and exec_toplevel_result =
{
Rpc.Types.name = "exec_toplevel_result";
Rpc.Types.description =
["Represents the result of executing a toplevel script"];
Rpc.Types.ty = typ_of_exec_toplevel_result
}
let _ = exec_toplevel_result_script
and _ = exec_toplevel_result_mime_vals
and _ = typ_of_exec_toplevel_result
and _ = exec_toplevel_result
end[@@ocaml.doc "@inline"][@@merlin.hide ]
type cma =
{
url: string [@ocaml.doc " URL where the cma is available "];
fn: string [@ocaml.doc " Name of the 'wrapping' function "]}[@@deriving
rpcty]
include
struct
let _ = fun (_ : cma) -> ()
let rec cma_url : (_, cma) Rpc.Types.field =
{
Rpc.Types.fname = "url";
Rpc.Types.field = (let open Rpc.Types in Basic String);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = ["URL where the cma is available"];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.url);
Rpc.Types.fset = (fun v -> fun _s -> { _s with url = v })
}
and cma_fn : (_, cma) Rpc.Types.field =
{
Rpc.Types.fname = "fn";
Rpc.Types.field = (let open Rpc.Types in Basic String);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = ["Name of the 'wrapping' function"];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.fn);
Rpc.Types.fset = (fun v -> fun _s -> { _s with fn = v })
}
and typ_of_cma =
Rpc.Types.Struct
({
Rpc.Types.fields =
[Rpc.Types.BoxedField cma_url; Rpc.Types.BoxedField cma_fn];
Rpc.Types.sname = "cma";
Rpc.Types.version = None;
Rpc.Types.constructor =
(fun getter ->
let open Rresult.R in
(getter.Rpc.Types.field_get "fn"
(let open Rpc.Types in Basic String))
>>=
(fun cma_fn ->
(getter.Rpc.Types.field_get "url"
(let open Rpc.Types in Basic String))
>>=
(fun cma_url ->
return { url = cma_url; fn = cma_fn })))
} : cma Rpc.Types.structure)
and cma =
{
Rpc.Types.name = "cma";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_cma
}
let _ = cma_url
and _ = cma_fn
and _ = typ_of_cma
and _ = cma
end[@@ocaml.doc "@inline"][@@merlin.hide ]
type init_libs =
{
path: string ;
cmis: cmis ;
cmas: cma list ;
findlib_index: string ;
findlib_requires: string list ;
stdlib_dcs: string }[@@deriving rpcty]
include
struct
let _ = fun (_ : init_libs) -> ()
let rec init_libs_path : (_, init_libs) Rpc.Types.field =
{
Rpc.Types.fname = "path";
Rpc.Types.field = (let open Rpc.Types in Basic String);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.path);
Rpc.Types.fset = (fun v -> fun _s -> { _s with path = v })
}
and init_libs_cmis : (_, init_libs) Rpc.Types.field =
{
Rpc.Types.fname = "cmis";
Rpc.Types.field = typ_of_cmis;
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.cmis);
Rpc.Types.fset = (fun v -> fun _s -> { _s with cmis = v })
}
and init_libs_cmas : (_, init_libs) Rpc.Types.field =
{
Rpc.Types.fname = "cmas";
Rpc.Types.field = (Rpc.Types.List typ_of_cma);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.cmas);
Rpc.Types.fset = (fun v -> fun _s -> { _s with cmas = v })
}
and init_libs_findlib_index : (_, init_libs) Rpc.Types.field =
{
Rpc.Types.fname = "findlib_index";
Rpc.Types.field = (let open Rpc.Types in Basic String);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.findlib_index);
Rpc.Types.fset = (fun v -> fun _s -> { _s with findlib_index = v })
}
and init_libs_findlib_requires : (_, init_libs) Rpc.Types.field =
{
Rpc.Types.fname = "findlib_requires";
Rpc.Types.field =
(Rpc.Types.List (let open Rpc.Types in Basic String));
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.findlib_requires);
Rpc.Types.fset =
(fun v -> fun _s -> { _s with findlib_requires = v })
}
and init_libs_stdlib_dcs : (_, init_libs) Rpc.Types.field =
{
Rpc.Types.fname = "stdlib_dcs";
Rpc.Types.field = (let open Rpc.Types in Basic String);
Rpc.Types.fdefault = None;
Rpc.Types.fdescription = [];
Rpc.Types.fversion = None;
Rpc.Types.fget = (fun _r -> _r.stdlib_dcs);
Rpc.Types.fset = (fun v -> fun _s -> { _s with stdlib_dcs = v })
}
and typ_of_init_libs =
Rpc.Types.Struct
({
Rpc.Types.fields =
[Rpc.Types.BoxedField init_libs_path;
Rpc.Types.BoxedField init_libs_cmis;
Rpc.Types.BoxedField init_libs_cmas;
Rpc.Types.BoxedField init_libs_findlib_index;
Rpc.Types.BoxedField init_libs_findlib_requires;
Rpc.Types.BoxedField init_libs_stdlib_dcs];
Rpc.Types.sname = "init_libs";
Rpc.Types.version = None;
Rpc.Types.constructor =
(fun getter ->
let open Rresult.R in
(getter.Rpc.Types.field_get "stdlib_dcs"
(let open Rpc.Types in Basic String))
>>=
(fun init_libs_stdlib_dcs ->
(getter.Rpc.Types.field_get "findlib_requires"
(Rpc.Types.List
(let open Rpc.Types in Basic String)))
>>=
(fun init_libs_findlib_requires ->
(getter.Rpc.Types.field_get "findlib_index"
(let open Rpc.Types in Basic String))
>>=
(fun init_libs_findlib_index ->
(getter.Rpc.Types.field_get "cmas"
(Rpc.Types.List typ_of_cma))
>>=
(fun init_libs_cmas ->
(getter.Rpc.Types.field_get "cmis"
typ_of_cmis)
>>=
(fun init_libs_cmis ->
(getter.Rpc.Types.field_get "path"
(let open Rpc.Types in
Basic String))
>>=
(fun init_libs_path ->
return
{
path = init_libs_path;
cmis = init_libs_cmis;
cmas = init_libs_cmas;
findlib_index =
init_libs_findlib_index;
findlib_requires =
init_libs_findlib_requires;
stdlib_dcs =
init_libs_stdlib_dcs
})))))))
} : init_libs Rpc.Types.structure)
and init_libs =
{
Rpc.Types.name = "init_libs";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_init_libs
}
let _ = init_libs_path
and _ = init_libs_cmis
and _ = init_libs_cmas
and _ = init_libs_findlib_index
and _ = init_libs_findlib_requires
and _ = init_libs_stdlib_dcs
and _ = typ_of_init_libs
and _ = init_libs
end[@@ocaml.doc "@inline"][@@merlin.hide ]
type err =
| InternalError of string [@@deriving rpcty]
include
struct
let _ = fun (_ : err) -> ()
let rec typ_of_err =
Rpc.Types.Variant
({
Rpc.Types.vname = "err";
Rpc.Types.variants =
[BoxedTag
{
Rpc.Types.tname = "InternalError";
Rpc.Types.tcontents =
((let open Rpc.Types in Basic String));
Rpc.Types.tversion = None;
Rpc.Types.tdescription = [];
Rpc.Types.tpreview =
((function | InternalError a0 -> Some a0));
Rpc.Types.treview = ((function | a0 -> InternalError a0))
}];
Rpc.Types.vdefault = None;
Rpc.Types.vversion = None;
Rpc.Types.vconstructor =
(fun s' ->
fun t ->
let s = String.lowercase_ascii s' in
match s with
| "internalerror" ->
Rresult.R.bind
(t.tget (let open Rpc.Types in Basic String))
(function | a0 -> Rresult.R.ok (InternalError a0))
| _ ->
Rresult.R.error_msg
(Printf.sprintf "Unknown tag '%s'" s))
} : err Rpc.Types.variant)
and err =
{
Rpc.Types.name = "err";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_err
}
let _ = typ_of_err
and _ = err
end[@@ocaml.doc "@inline"][@@merlin.hide ]
type opt_id = string option[@@deriving rpcty]
include
struct
let _ = fun (_ : opt_id) -> ()
let rec typ_of_opt_id =
Rpc.Types.Option (let open Rpc.Types in Basic String)
and opt_id =
{
Rpc.Types.name = "opt_id";
Rpc.Types.description = [];
Rpc.Types.ty = typ_of_opt_id
}
let _ = typ_of_opt_id
and _ = opt_id
end[@@ocaml.doc "@inline"][@@merlin.hide ]
module E =
(Idl.Error.Make)(struct
type t = err
let t = err
let internal_error_of e =
Some (InternalError (Printexc.to_string e))
end)
let err = E.error
module Make(R:RPC) =
struct
open R
let description =
let open Interface in
{
name = "Toplevel";
namespace = None;
description =
["Functions for manipulating the toplevel worker thread"];
version = (1, 0, 0)
}
let implementation = implement description
let unit_p = Param.mk Types.unit
let phrase_p = Param.mk Types.string
let id_p = Param.mk opt_id
let typecheck_result_p = Param.mk exec_result
let exec_result_p = Param.mk exec_result
let source_p = Param.mk source
let position_p = Param.mk msource_position
let completions_p = Param.mk completions
let error_list_p = Param.mk error_list
let typed_enclosings_p = Param.mk typed_enclosings_list
let toplevel_script_p =
Param.mk
~description:["A toplevel script is a sequence of toplevel phrases interspersed with";
"The output from the toplevel. Each phase must be preceded by '# ', and";
"the output from the toplevel is indented by 2 spaces."]
Types.string
let exec_toplevel_result_p = Param.mk exec_toplevel_result
let init_libs =
Param.mk ~name:"init_libs"
~description:["Libraries to load during the initialisation of the toplevel. ";
"If the stdlib cmis have not been compiled into the worker this ";
"MUST include the urls from which they may be fetched"]
init_libs
let init =
declare "init"
["Initialise the toplevel. This must be called before any other API."]
(init_libs @-> (returning unit_p err))
let setup =
declare "setup"
["Start the toplevel. Return value is the initial blurb ";
"printed when starting a toplevel. Note that the toplevel";
"must be initialised first."]
(unit_p @-> (returning exec_result_p err))
let typecheck =
declare "typecheck"
["Typecheck a phrase without actually executing it."]
(phrase_p @-> (returning typecheck_result_p err))
let exec =
declare "exec"
["Execute a phrase using the toplevel. The toplevel must have been";
"Initialised first."] (phrase_p @-> (returning exec_result_p err))
let exec_toplevel =
declare "exec_toplevel"
["Execute a toplevel script. The toplevel must have been";
"Initialised first. Returns the updated toplevel script."]
(toplevel_script_p @-> (returning exec_toplevel_result_p err))
let compile_js =
declare "compile_js"
["Compile a phrase to javascript. The toplevel must have been";
"Initialised first."]
(id_p @-> (phrase_p @-> (returning phrase_p err)))
let complete_prefix =
declare "complete_prefix" ["Complete a prefix"]
(source_p @-> (position_p @-> (returning completions_p err)))
let query_errors =
declare "query_errors" ["Query the errors in the given source"]
(source_p @-> (returning error_list_p err))
let type_enclosing =
declare "type_enclosing" ["Get the type of the enclosing expression"]
(source_p @-> (position_p @-> (returning typed_enclosings_p err)))
end