@@ -620,18 +620,18 @@ let completionsGetCompletionType ~full = function
620
620
| {Completion. kind = ExtractedType (typ , _ ); env} :: _ -> Some (typ, env)
621
621
| _ -> None
622
622
623
- let rec completionsGetCompletionType2 ~full ~opens ~rawOpens ~allFiles ~ pos
624
- ~scope = function
623
+ let rec completionsGetCompletionType2 ~debug ~ full ~opens ~rawOpens ~allFiles
624
+ ~pos ~ scope = function
625
625
| {Completion. kind = Value typ; env} :: _
626
626
| {Completion. kind = ObjLabel typ; env} :: _
627
627
| {Completion. kind = Field ({typ} , _ ); env} :: _ ->
628
628
Some (TypeExpr typ, env)
629
629
| {Completion. kind = FollowContextPath ctxPath ; env} :: _ ->
630
630
ctxPath
631
- |> getCompletionsForContextPath ~full ~env ~exact: true ~opens ~raw Opens
632
- ~all Files ~pos ~scope
633
- |> completionsGetCompletionType2 ~full ~opens ~raw Opens ~all Files ~pos
634
- ~scope
631
+ |> getCompletionsForContextPath ~debug ~ full ~env ~exact: true ~opens
632
+ ~raw Opens ~ all Files ~pos ~scope
633
+ |> completionsGetCompletionType2 ~debug ~ full ~opens ~raw Opens ~all Files
634
+ ~pos ~ scope
635
635
| {Completion. kind = Type typ ; env} :: _ -> (
636
636
match TypeUtils. extractTypeFromResolvedType typ ~env ~full with
637
637
| None -> None
@@ -640,21 +640,25 @@ let rec completionsGetCompletionType2 ~full ~opens ~rawOpens ~allFiles ~pos
640
640
Some (ExtractedType typ, env)
641
641
| _ -> None
642
642
643
- and completionsGetTypeEnv2 (completions : Completion.t list ) ~full ~opens
643
+ and completionsGetTypeEnv2 ~ debug (completions : Completion.t list ) ~full ~opens
644
644
~rawOpens ~allFiles ~pos ~scope =
645
645
match completions with
646
646
| {Completion. kind = Value typ ; env} :: _ -> Some (typ, env)
647
647
| {Completion. kind = ObjLabel typ ; env} :: _ -> Some (typ, env)
648
648
| {Completion. kind = Field ({typ} , _ ); env} :: _ -> Some (typ, env)
649
649
| {Completion. kind = FollowContextPath ctxPath ; env} :: _ ->
650
650
ctxPath
651
- |> getCompletionsForContextPath ~full ~opens ~raw Opens ~all Files ~pos ~env
652
- ~exact: true ~scope
653
- |> completionsGetTypeEnv2 ~full ~opens ~raw Opens ~all Files ~pos ~scope
651
+ |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~all Files ~pos
652
+ ~env ~exact: true ~scope
653
+ |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~all Files ~pos
654
+ ~scope
654
655
| _ -> None
655
656
656
- and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
657
- ~exact ~scope ?(mode = Regular ) (contextPath : Completable.contextPath ) =
657
+ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~pos
658
+ ~env ~exact ~scope ?(mode = Regular ) contextPath =
659
+ if debug then
660
+ Printf. printf " ContextPath %s\n "
661
+ (Completable. contextPathToString contextPath);
658
662
let package = full.package in
659
663
match contextPath with
660
664
| CPString ->
@@ -697,8 +701,8 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
697
701
| Regular -> (
698
702
match
699
703
cp
700
- |> getCompletionsForContextPath ~full ~opens ~raw Opens ~all Files ~pos
701
- ~env ~exact: true ~scope
704
+ |> getCompletionsForContextPath ~debug ~ full ~opens ~raw Opens ~all Files
705
+ ~pos ~ env ~exact: true ~scope
702
706
|> completionsGetCompletionType ~full
703
707
with
704
708
| None -> []
@@ -720,8 +724,8 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
720
724
| CPOption cp -> (
721
725
match
722
726
cp
723
- |> getCompletionsForContextPath ~full ~opens ~raw Opens ~all Files ~pos ~env
724
- ~exact: true ~scope
727
+ |> getCompletionsForContextPath ~debug ~ full ~opens ~raw Opens ~all Files
728
+ ~pos ~env ~ exact:true ~scope
725
729
|> completionsGetCompletionType ~full
726
730
with
727
731
| None -> []
@@ -738,10 +742,10 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
738
742
| CPApply (cp , labels ) -> (
739
743
match
740
744
cp
741
- |> getCompletionsForContextPath ~full ~opens ~raw Opens ~all Files ~pos ~env
742
- ~exact: true ~scope
743
- |> completionsGetCompletionType2 ~full ~opens ~raw Opens ~all Files ~pos
744
- ~scope
745
+ |> getCompletionsForContextPath ~debug ~ full ~opens ~raw Opens ~all Files
746
+ ~pos ~env ~ exact:true ~scope
747
+ |> completionsGetCompletionType2 ~debug ~ full ~opens ~raw Opens ~all Files
748
+ ~pos ~ scope
745
749
with
746
750
| Some ((TypeExpr typ | ExtractedType (Tfunction {typ} )), env ) -> (
747
751
let rec reconstructFunctionType args tRet =
@@ -785,14 +789,14 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
785
789
| CPField (cp , fieldName ) -> (
786
790
let completionsForCtxPath =
787
791
cp
788
- |> getCompletionsForContextPath ~full ~opens ~raw Opens ~all Files ~pos ~env
789
- ~exact: true ~scope
792
+ |> getCompletionsForContextPath ~debug ~ full ~opens ~raw Opens ~all Files
793
+ ~pos ~env ~ exact:true ~scope
790
794
in
791
795
let extracted =
792
796
match
793
797
completionsForCtxPath
794
- |> completionsGetCompletionType2 ~full ~opens ~raw Opens ~all Files ~pos
795
- ~scope
798
+ |> completionsGetCompletionType2 ~debug ~ full ~opens ~raw Opens ~all Files
799
+ ~pos ~ scope
796
800
with
797
801
| Some (TypeExpr typ , env ) -> (
798
802
match typ |> TypeUtils. extractRecordType ~env ~package with
@@ -824,9 +828,10 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
824
828
(* TODO: Also needs to support ExtractedType *)
825
829
match
826
830
cp
827
- |> getCompletionsForContextPath ~full ~opens ~raw Opens ~all Files ~pos ~env
828
- ~exact: true ~scope
829
- |> completionsGetTypeEnv2 ~full ~opens ~raw Opens ~all Files ~pos ~scope
831
+ |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~all Files
832
+ ~pos ~env ~exact: true ~scope
833
+ |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~all Files ~pos
834
+ ~scope
830
835
with
831
836
| Some (typ , env ) -> (
832
837
match typ |> TypeUtils. extractObjectType ~env ~package with
@@ -851,9 +856,10 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
851
856
| CPPipe {contextPath = cp ; id = funNamePrefix ; lhsLoc; inJsx} -> (
852
857
match
853
858
cp
854
- |> getCompletionsForContextPath ~full ~opens ~raw Opens ~all Files ~pos ~env
855
- ~exact: true ~scope ~mode: Pipe
856
- |> completionsGetTypeEnv2 ~full ~opens ~raw Opens ~all Files ~pos ~scope
859
+ |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~all Files
860
+ ~pos ~env ~exact: true ~scope ~mode: Pipe
861
+ |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~all Files ~pos
862
+ ~scope
857
863
with
858
864
| None -> []
859
865
| Some (typ , envFromCompletionItem ) -> (
@@ -994,8 +1000,8 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
994
1000
ctxPaths
995
1001
|> List. map (fun contextPath ->
996
1002
contextPath
997
- |> getCompletionsForContextPath ~full ~opens ~raw Opens ~all Files
998
- ~pos ~env ~exact: true ~scope )
1003
+ |> getCompletionsForContextPath ~debug ~ full ~opens ~raw Opens
1004
+ ~all Files ~ pos ~env ~exact: true ~scope )
999
1005
|> List. filter_map (fun completionItems ->
1000
1006
match completionItems with
1001
1007
| {Completion. kind = Value typ } :: _ -> Some typ
@@ -1012,7 +1018,8 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
1012
1018
path
1013
1019
|> getCompletionsForPath ~completion Context:Value ~exact: true ~package
1014
1020
~opens ~all Files ~pos ~env ~scope
1015
- |> completionsGetTypeEnv2 ~full ~opens ~raw Opens ~all Files ~pos ~scope
1021
+ |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~all Files ~pos
1022
+ ~scope
1016
1023
in
1017
1024
let lowercaseComponent =
1018
1025
match pathToComponent with
@@ -1056,10 +1063,10 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
1056
1063
let labels, env =
1057
1064
match
1058
1065
functionContextPath
1059
- |> getCompletionsForContextPath ~full ~opens ~raw Opens ~all Files ~pos
1060
- ~env ~exact: true ~scope
1061
- |> completionsGetCompletionType2 ~full ~opens ~raw Opens ~all Files ~pos
1062
- ~scope
1066
+ |> getCompletionsForContextPath ~debug ~ full ~opens ~raw Opens ~all Files
1067
+ ~pos ~ env ~exact: true ~scope
1068
+ |> completionsGetCompletionType2 ~debug ~ full ~opens ~raw Opens ~all Files
1069
+ ~pos ~ scope
1063
1070
with
1064
1071
| Some ((TypeExpr typ | ExtractedType (Tfunction {typ} )), env ) ->
1065
1072
(typ |> TypeUtils. getArgs ~full ~env , env)
@@ -1094,10 +1101,10 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
1094
1101
| CPatternPath {rootCtxPath; nested} -> (
1095
1102
match
1096
1103
rootCtxPath
1097
- |> getCompletionsForContextPath ~full ~opens ~raw Opens ~all Files ~pos ~env
1098
- ~exact: true ~scope
1099
- |> completionsGetCompletionType2 ~full ~opens ~raw Opens ~all Files ~pos
1100
- ~scope
1104
+ |> getCompletionsForContextPath ~debug ~ full ~opens ~raw Opens ~all Files
1105
+ ~pos ~env ~ exact:true ~scope
1106
+ |> completionsGetCompletionType2 ~debug ~ full ~opens ~raw Opens ~all Files
1107
+ ~pos ~ scope
1101
1108
with
1102
1109
| Some (typ , env ) -> (
1103
1110
match typ |> TypeUtils. resolveNestedPatternPath ~env ~full ~nested with
@@ -1407,14 +1414,15 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
1407
1414
path
1408
1415
|> getCompletionsForPath ~completion Context:Value ~exact: true ~package
1409
1416
~opens ~all Files ~pos ~env ~scope
1410
- |> completionsGetTypeEnv2 ~full ~opens ~raw Opens ~all Files ~pos ~scope
1417
+ |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~all Files ~pos
1418
+ ~scope
1411
1419
in
1412
1420
match completable with
1413
1421
| Cnone -> []
1414
1422
| Cpath contextPath ->
1415
1423
contextPath
1416
- |> getCompletionsForContextPath ~full ~opens ~raw Opens ~all Files ~pos ~env
1417
- ~exact: forHover ~scope
1424
+ |> getCompletionsForContextPath ~debug ~ full ~opens ~raw Opens ~all Files ~pos
1425
+ ~env ~ exact: forHover ~scope
1418
1426
| Cjsx ([id ], prefix , identsSeen ) when String. uncapitalize_ascii id = id ->
1419
1427
(* Lowercase JSX tag means builtin *)
1420
1428
let mkLabel (name , typString ) =
@@ -1471,9 +1479,10 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
1471
1479
let labels =
1472
1480
match
1473
1481
cp
1474
- |> getCompletionsForContextPath ~full ~opens ~raw Opens ~all Files ~pos
1475
- ~env ~exact: true ~scope
1476
- |> completionsGetTypeEnv2 ~full ~opens ~raw Opens ~all Files ~pos ~scope
1482
+ |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~all Files
1483
+ ~pos ~env ~exact: true ~scope
1484
+ |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~all Files ~pos
1485
+ ~scope
1477
1486
with
1478
1487
| Some (typ , _env ) ->
1479
1488
if debug then
@@ -1507,9 +1516,10 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
1507
1516
in
1508
1517
match
1509
1518
contextPath
1510
- |> getCompletionsForContextPath ~full ~opens ~raw Opens ~all Files ~pos ~env
1511
- ~exact: true ~scope
1512
- |> completionsGetTypeEnv2 ~full ~opens ~raw Opens ~all Files ~pos ~scope
1519
+ |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~all Files
1520
+ ~pos ~env ~exact: true ~scope
1521
+ |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~all Files ~pos
1522
+ ~scope
1513
1523
with
1514
1524
| Some (typ , env ) -> (
1515
1525
match
@@ -1540,8 +1550,8 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
1540
1550
in
1541
1551
match
1542
1552
contextPath
1543
- |> getCompletionsForContextPath ~full ~opens ~raw Opens ~all Files ~pos ~env
1544
- ~exact: true ~scope
1553
+ |> getCompletionsForContextPath ~debug ~ full ~opens ~raw Opens ~all Files
1554
+ ~pos ~env ~ exact:true ~scope
1545
1555
|> completionsGetCompletionType ~full
1546
1556
with
1547
1557
| None -> regularCompletions
@@ -1620,8 +1630,8 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
1620
1630
in
1621
1631
let completionsForContextPath =
1622
1632
contextPath
1623
- |> getCompletionsForContextPath ~full ~opens ~raw Opens ~all Files ~pos ~env
1624
- ~exact: forHover ~scope
1633
+ |> getCompletionsForContextPath ~debug ~ full ~opens ~raw Opens ~all Files
1634
+ ~pos ~env ~ exact: forHover ~scope
1625
1635
in
1626
1636
completionsForContextPath
1627
1637
|> List. map (fun (c : Completion.t ) ->
0 commit comments