@@ -557,9 +557,8 @@ let completionForExporteds iterExported getDeclared ~prefix ~exact ~env
557
557
Hashtbl. add namesUsed declared.name.txt () ;
558
558
res :=
559
559
{
560
- (Completion. create ~name: declared.name.txt ~env
561
- ~kind: (transformContents declared.item)
562
- () )
560
+ (Completion. create declared.name.txt ~env
561
+ ~kind: (transformContents declared.item))
563
562
with
564
563
deprecated = declared.deprecated;
565
564
docstring = declared.docstring;
@@ -598,11 +597,10 @@ let completionsForExportedConstructors ~(env : QueryEnv.t) ~prefix ~exact
598
597
if not (Hashtbl. mem namesUsed name) then
599
598
let () = Hashtbl. add namesUsed name () in
600
599
Some
601
- (Completion. create ~ name ~env ~docstring: c.docstring
600
+ (Completion. create name ~env ~docstring: c.docstring
602
601
~kind:
603
602
(Completion. Constructor
604
- (c, t.item.decl |> Shared. declToString t.name.txt))
605
- () )
603
+ (c, t.item.decl |> Shared. declToString t.name.txt)))
606
604
else None ))
607
605
@ ! res
608
606
| _ -> () );
@@ -621,11 +619,10 @@ let completionForExportedFields ~(env : QueryEnv.t) ~prefix ~exact ~namesUsed =
621
619
if not (Hashtbl. mem namesUsed name) then
622
620
let () = Hashtbl. add namesUsed name () in
623
621
Some
624
- (Completion. create ~ name ~env ~docstring: f.docstring
622
+ (Completion. create name ~env ~docstring: f.docstring
625
623
~kind:
626
624
(Completion. Field
627
- (f, t.item.decl |> Shared. declToString t.name.txt))
628
- () )
625
+ (f, t.item.decl |> Shared. declToString t.name.txt)))
629
626
else None ))
630
627
@ ! res
631
628
| _ -> () );
@@ -803,8 +800,7 @@ let processLocalValue name loc ~prefix ~exact ~env
803
800
Hashtbl. add localTables.namesUsed name () ;
804
801
localTables.resultRev < -
805
802
{
806
- (Completion. create ~name: declared.name.txt ~env
807
- ~kind: (Value declared.item) () )
803
+ (Completion. create declared.name.txt ~env ~kind: (Value declared.item))
808
804
with
809
805
deprecated = declared.deprecated;
810
806
docstring = declared.docstring;
@@ -815,13 +811,12 @@ let processLocalValue name loc ~prefix ~exact ~env
815
811
(Printf. sprintf " Completion Value Not Found %s loc:%s\n " name
816
812
(Loc. toString loc));
817
813
localTables.resultRev < -
818
- Completion. create ~ name ~env
814
+ Completion. create name ~env
819
815
~kind:
820
816
(Value
821
817
(Ctype. newconstr
822
818
(Path. Pident (Ident. create " Type Not Known" ))
823
819
[] ))
824
- ()
825
820
:: localTables.resultRev
826
821
827
822
let processLocalConstructor name loc ~prefix ~exact ~env
@@ -835,13 +830,12 @@ let processLocalConstructor name loc ~prefix ~exact ~env
835
830
Hashtbl. add localTables.namesUsed name () ;
836
831
localTables.resultRev < -
837
832
{
838
- (Completion. create ~name: declared.name.txt ~env
833
+ (Completion. create declared.name.txt ~env
839
834
~kind:
840
835
(Constructor
841
836
( declared.item,
842
837
snd declared.item.typeDecl
843
- |> Shared. declToString (fst declared.item.typeDecl) ))
844
- () )
838
+ |> Shared. declToString (fst declared.item.typeDecl) )))
845
839
with
846
840
deprecated = declared.deprecated;
847
841
docstring = declared.docstring;
@@ -861,8 +855,7 @@ let processLocalType name loc ~prefix ~exact ~env ~(localTables : LocalTables.t)
861
855
Hashtbl. add localTables.namesUsed name () ;
862
856
localTables.resultRev < -
863
857
{
864
- (Completion. create ~name: declared.name.txt ~env
865
- ~kind: (Type declared.item) () )
858
+ (Completion. create declared.name.txt ~env ~kind: (Type declared.item))
866
859
with
867
860
deprecated = declared.deprecated;
868
861
docstring = declared.docstring;
@@ -882,8 +875,8 @@ let processLocalModule name loc ~prefix ~exact ~env
882
875
Hashtbl. add localTables.namesUsed name () ;
883
876
localTables.resultRev < -
884
877
{
885
- (Completion. create ~name: declared.name.txt ~env
886
- ~kind: (Module declared.item) () )
878
+ (Completion. create declared.name.txt ~env
879
+ ~kind: (Module declared.item))
887
880
with
888
881
deprecated = declared.deprecated;
889
882
docstring = declared.docstring;
@@ -1144,8 +1137,7 @@ let getComplementaryCompletionsForTypedValue ~opens ~allFiles ~scope ~env prefix
1144
1137
(String. contains name '-' )
1145
1138
then
1146
1139
Some
1147
- (Completion. create ~name ~env ~kind: (Completion. FileModule name)
1148
- () )
1140
+ (Completion. create name ~env ~kind: (Completion. FileModule name))
1149
1141
else None )
1150
1142
in
1151
1143
localCompletionsWithOpens @ fileModules
@@ -1169,8 +1161,7 @@ let getCompletionsForPath ~package ~opens ~allFiles ~pos ~exact ~scope
1169
1161
(String. contains name '-' )
1170
1162
then
1171
1163
Some
1172
- (Completion. create ~name ~env
1173
- ~kind: (Completion. FileModule name) () )
1164
+ (Completion. create name ~env ~kind: (Completion. FileModule name))
1174
1165
else None )
1175
1166
in
1176
1167
localCompletionsWithOpens @ fileModules
@@ -1356,35 +1347,31 @@ let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
1356
1347
match contextPath with
1357
1348
| CPString ->
1358
1349
[
1359
- Completion. create ~name: " string" ~env
1350
+ Completion. create " string" ~env
1360
1351
~kind:
1361
1352
(Completion. Value
1362
- (Ctype. newconstr (Path. Pident (Ident. create " string" )) [] ))
1363
- () ;
1353
+ (Ctype. newconstr (Path. Pident (Ident. create " string" )) [] ));
1364
1354
]
1365
1355
| CPInt ->
1366
1356
[
1367
- Completion. create ~name: " int" ~env
1357
+ Completion. create " int" ~env
1368
1358
~kind:
1369
1359
(Completion. Value
1370
- (Ctype. newconstr (Path. Pident (Ident. create " int" )) [] ))
1371
- () ;
1360
+ (Ctype. newconstr (Path. Pident (Ident. create " int" )) [] ));
1372
1361
]
1373
1362
| CPFloat ->
1374
1363
[
1375
- Completion. create ~name: " float" ~env
1364
+ Completion. create " float" ~env
1376
1365
~kind:
1377
1366
(Completion. Value
1378
- (Ctype. newconstr (Path. Pident (Ident. create " float" )) [] ))
1379
- () ;
1367
+ (Ctype. newconstr (Path. Pident (Ident. create " float" )) [] ));
1380
1368
]
1381
1369
| CPArray ->
1382
1370
[
1383
- Completion. create ~name: " array" ~env
1371
+ Completion. create " array" ~env
1384
1372
~kind:
1385
1373
(Completion. Value
1386
- (Ctype. newconstr (Path. Pident (Ident. create " array" )) [] ))
1387
- () ;
1374
+ (Ctype. newconstr (Path. Pident (Ident. create " array" )) [] ));
1388
1375
]
1389
1376
| CPId (path , completionContext ) ->
1390
1377
path
@@ -1428,10 +1415,7 @@ let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
1428
1415
| args , tRet when args <> [] ->
1429
1416
let args = processApply args labels in
1430
1417
let retType = reconstructFunctionType args tRet in
1431
- [
1432
- Completion. create ~name: " dummy" ~env ~kind: (Completion. Value retType)
1433
- () ;
1434
- ]
1418
+ [Completion. create " dummy" ~env ~kind: (Completion. Value retType)]
1435
1419
| _ -> [] )
1436
1420
| None -> [])
1437
1421
| CPField (CPId (path , Module), fieldName ) ->
@@ -1453,14 +1437,13 @@ let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
1453
1437
|> Utils. filterMap (fun field ->
1454
1438
if checkName field.fname.txt ~prefix: fieldName ~exact then
1455
1439
Some
1456
- (Completion. create ~name: field.fname.txt ~env
1440
+ (Completion. create field.fname.txt ~env
1457
1441
~docstring: field.docstring
1458
1442
~kind:
1459
1443
(Completion. Field
1460
1444
( field,
1461
1445
typDecl.item.decl
1462
- |> Shared. declToString typDecl.name.txt ))
1463
- () )
1446
+ |> Shared. declToString typDecl.name.txt )))
1464
1447
else None )
1465
1448
| None -> [] )
1466
1449
| None -> [] )
@@ -1487,8 +1470,7 @@ let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
1487
1470
|> Utils. filterMap (fun (field , typ ) ->
1488
1471
if checkName field ~prefix: label ~exact then
1489
1472
Some
1490
- (Completion. create ~name: field ~env
1491
- ~kind: (Completion. ObjLabel typ) () )
1473
+ (Completion. create field ~env ~kind: (Completion. ObjLabel typ))
1492
1474
else None )
1493
1475
| None -> [] )
1494
1476
| None -> [] )
@@ -1670,9 +1652,8 @@ let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
1670
1652
in
1671
1653
if List. length ctxPaths = List. length typeExrps then
1672
1654
[
1673
- Completion. create ~name: " dummy" ~env
1674
- ~kind: (Completion. Value (Ctype. newty (Ttuple typeExrps)))
1675
- () ;
1655
+ Completion. create " dummy" ~env
1656
+ ~kind: (Completion. Value (Ctype. newty (Ttuple typeExrps)));
1676
1657
]
1677
1658
else []
1678
1659
| CJsxPropValue {pathToComponent; propName} -> (
@@ -1690,9 +1671,8 @@ let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
1690
1671
| None -> []
1691
1672
| Some (_ , typ , env ) ->
1692
1673
[
1693
- Completion. create ~name: " dummy" ~env
1694
- ~kind: (Completion. Value (Utils. unwrapIfOption typ))
1695
- () ;
1674
+ Completion. create " dummy" ~env
1675
+ ~kind: (Completion. Value (Utils. unwrapIfOption typ));
1696
1676
])
1697
1677
| CArgument {functionContextPath; argumentLabel} -> (
1698
1678
let labels, env =
@@ -1724,11 +1704,10 @@ let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
1724
1704
| None -> []
1725
1705
| Some (_ , typ ) ->
1726
1706
[
1727
- Completion. create ~name: " dummy" ~env
1707
+ Completion. create " dummy" ~env
1728
1708
~kind:
1729
1709
(Completion. Value
1730
- (if expandOption then Utils. unwrapIfOption typ else typ))
1731
- () ;
1710
+ (if expandOption then Utils. unwrapIfOption typ else typ));
1732
1711
])
1733
1712
1734
1713
let getOpens ~debug ~rawOpens ~package ~env =
@@ -1819,12 +1798,8 @@ let rec completeTypedValue (t : Types.type_expr) ~env ~full ~prefix
1819
1798
match t |> extractType ~env ~package: full.package with
1820
1799
| Some (Tbool env ) ->
1821
1800
[
1822
- Completion. create ~name: " true"
1823
- ~kind: (Label (t |> Shared. typeToString))
1824
- ~env () ;
1825
- Completion. create ~name: " false"
1826
- ~kind: (Label (t |> Shared. typeToString))
1827
- ~env () ;
1801
+ Completion. create " true" ~kind: (Label (t |> Shared. typeToString)) ~env ;
1802
+ Completion. create " false" ~kind: (Label (t |> Shared. typeToString)) ~env ;
1828
1803
]
1829
1804
|> filterItems ~prefix
1830
1805
| Some (Tvariant {env; constructors; variantDecl; variantName} ) ->
@@ -1883,9 +1858,7 @@ let rec completeTypedValue (t : Types.type_expr) ~env ~full ~prefix
1883
1858
})
1884
1859
in
1885
1860
[
1886
- Completion. create ~name: " None"
1887
- ~kind: (Label (t |> Shared. typeToString))
1888
- ~env () ;
1861
+ Completion. create " None" ~kind: (Label (t |> Shared. typeToString)) ~env ;
1889
1862
Completion. createWithSnippet ~name: " Some(_)"
1890
1863
~kind: (Label (t |> Shared. typeToString))
1891
1864
~env ~insert Text:" Some(${1:_})" () ;
@@ -1910,9 +1883,9 @@ let rec completeTypedValue (t : Types.type_expr) ~env ~full ~prefix
1910
1883
|> List. filter (fun (field : field ) ->
1911
1884
List. mem field.fname.txt seenFields = false )
1912
1885
|> List. map (fun (field : field ) ->
1913
- Completion. create ~name: field.fname.txt
1886
+ Completion. create field.fname.txt
1914
1887
~kind: (Field (field, typeExpr |> Shared. typeToString))
1915
- ~env () )
1888
+ ~env )
1916
1889
|> filterItems ~prefix
1917
1890
| None ->
1918
1891
if prefix = " " then
@@ -2016,7 +1989,7 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover
2016
1989
| Cjsx ([id ], prefix , identsSeen ) when String. uncapitalize_ascii id = id ->
2017
1990
(* Lowercase JSX tag means builtin *)
2018
1991
let mkLabel (name , typString ) =
2019
- Completion. create ~ name ~kind: (Label typString) ~env ()
1992
+ Completion. create name ~kind: (Label typString) ~env
2020
1993
in
2021
1994
let keyLabels =
2022
1995
if Utils. startsWith " key" prefix then [mkLabel (" key" , " string" )] else []
@@ -2030,7 +2003,7 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover
2030
2003
| Cjsx (componentPath , prefix , identsSeen ) ->
2031
2004
let labels = getJsxLabels ~component Path ~find TypeOfValue ~package in
2032
2005
let mkLabel_ name typString =
2033
- Completion. create ~ name ~kind: (Label typString) ~env ()
2006
+ Completion. create name ~kind: (Label typString) ~env
2034
2007
in
2035
2008
let mkLabel (name , typ , _env ) =
2036
2009
mkLabel_ name (typ |> Shared. typeToString)
@@ -2049,7 +2022,7 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover
2049
2022
@ keyLabels
2050
2023
| Cdecorator prefix ->
2051
2024
let mkDecorator (name , docstring ) =
2052
- {(Completion. create ~ name ~kind: (Label " " ) ~env () ) with docstring}
2025
+ {(Completion. create name ~kind: (Label " " ) ~env ) with docstring}
2053
2026
in
2054
2027
[
2055
2028
( " as" ,
@@ -2306,7 +2279,7 @@ Note: The `@react.component` decorator requires the react-jsx config to be set i
2306
2279
| None -> []
2307
2280
in
2308
2281
let mkLabel (name , typ ) =
2309
- Completion. create ~ name ~kind: (Label (typ |> Shared. typeToString)) ~env ()
2282
+ Completion. create name ~kind: (Label (typ |> Shared. typeToString)) ~env
2310
2283
in
2311
2284
labels
2312
2285
|> List. filter (fun (name , _t ) ->
0 commit comments