@@ -620,18 +620,18 @@ let completionsGetCompletionType ~full = function
620620 | {Completion. kind = ExtractedType (typ , _ ); env} :: _ -> Some (typ, env)
621621 | _ -> None
622622
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
625625 | {Completion. kind = Value typ; env} :: _
626626 | {Completion. kind = ObjLabel typ; env} :: _
627627 | {Completion. kind = Field ({typ} , _ ); env} :: _ ->
628628 Some (TypeExpr typ, env)
629629 | {Completion. kind = FollowContextPath ctxPath ; env} :: _ ->
630630 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
635635 | {Completion. kind = Type typ ; env} :: _ -> (
636636 match TypeUtils. extractTypeFromResolvedType typ ~env ~full with
637637 | None -> None
@@ -640,21 +640,25 @@ let rec completionsGetCompletionType2 ~full ~opens ~rawOpens ~allFiles ~pos
640640 Some (ExtractedType typ, env)
641641 | _ -> None
642642
643- and completionsGetTypeEnv2 (completions : Completion.t list ) ~full ~opens
643+ and completionsGetTypeEnv2 ~ debug (completions : Completion.t list ) ~full ~opens
644644 ~rawOpens ~allFiles ~pos ~scope =
645645 match completions with
646646 | {Completion. kind = Value typ ; env} :: _ -> Some (typ, env)
647647 | {Completion. kind = ObjLabel typ ; env} :: _ -> Some (typ, env)
648648 | {Completion. kind = Field ({typ} , _ ); env} :: _ -> Some (typ, env)
649649 | {Completion. kind = FollowContextPath ctxPath ; env} :: _ ->
650650 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
654655 | _ -> None
655656
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);
658662 let package = full.package in
659663 match contextPath with
660664 | CPString ->
@@ -697,8 +701,8 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
697701 | Regular -> (
698702 match
699703 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
702706 |> completionsGetCompletionType ~full
703707 with
704708 | None -> []
@@ -720,8 +724,8 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
720724 | CPOption cp -> (
721725 match
722726 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
725729 |> completionsGetCompletionType ~full
726730 with
727731 | None -> []
@@ -738,10 +742,10 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
738742 | CPApply (cp , labels ) -> (
739743 match
740744 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
745749 with
746750 | Some ((TypeExpr typ | ExtractedType (Tfunction {typ} )), env ) -> (
747751 let rec reconstructFunctionType args tRet =
@@ -785,14 +789,14 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
785789 | CPField (cp , fieldName ) -> (
786790 let completionsForCtxPath =
787791 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
790794 in
791795 let extracted =
792796 match
793797 completionsForCtxPath
794- |> completionsGetCompletionType2 ~full ~opens ~raw Opens ~all Files ~pos
795- ~scope
798+ |> completionsGetCompletionType2 ~debug ~ full ~opens ~raw Opens ~all Files
799+ ~pos ~ scope
796800 with
797801 | Some (TypeExpr typ , env ) -> (
798802 match typ |> TypeUtils. extractRecordType ~env ~package with
@@ -824,9 +828,10 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
824828 (* TODO: Also needs to support ExtractedType *)
825829 match
826830 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
830835 with
831836 | Some (typ , env ) -> (
832837 match typ |> TypeUtils. extractObjectType ~env ~package with
@@ -851,9 +856,10 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
851856 | CPPipe {contextPath = cp ; id = funNamePrefix ; lhsLoc; inJsx} -> (
852857 match
853858 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
857863 with
858864 | None -> []
859865 | Some (typ , envFromCompletionItem ) -> (
@@ -994,8 +1000,8 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
9941000 ctxPaths
9951001 |> List. map (fun contextPath ->
9961002 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 )
9991005 |> List. filter_map (fun completionItems ->
10001006 match completionItems with
10011007 | {Completion. kind = Value typ } :: _ -> Some typ
@@ -1012,7 +1018,8 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
10121018 path
10131019 |> getCompletionsForPath ~completion Context:Value ~exact: true ~package
10141020 ~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
10161023 in
10171024 let lowercaseComponent =
10181025 match pathToComponent with
@@ -1056,10 +1063,10 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
10561063 let labels, env =
10571064 match
10581065 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
10631070 with
10641071 | Some ((TypeExpr typ | ExtractedType (Tfunction {typ} )), env ) ->
10651072 (typ |> TypeUtils. getArgs ~full ~env , env)
@@ -1094,10 +1101,10 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
10941101 | CPatternPath {rootCtxPath; nested} -> (
10951102 match
10961103 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
11011108 with
11021109 | Some (typ , env ) -> (
11031110 match typ |> TypeUtils. resolveNestedPatternPath ~env ~full ~nested with
@@ -1407,14 +1414,15 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
14071414 path
14081415 |> getCompletionsForPath ~completion Context:Value ~exact: true ~package
14091416 ~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
14111419 in
14121420 match completable with
14131421 | Cnone -> []
14141422 | Cpath contextPath ->
14151423 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
14181426 | Cjsx ([id ], prefix , identsSeen ) when String. uncapitalize_ascii id = id ->
14191427 (* Lowercase JSX tag means builtin *)
14201428 let mkLabel (name , typString ) =
@@ -1471,9 +1479,10 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
14711479 let labels =
14721480 match
14731481 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
14771486 with
14781487 | Some (typ , _env ) ->
14791488 if debug then
@@ -1507,9 +1516,10 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
15071516 in
15081517 match
15091518 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
15131523 with
15141524 | Some (typ , env ) -> (
15151525 match
@@ -1540,8 +1550,8 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
15401550 in
15411551 match
15421552 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
15451555 |> completionsGetCompletionType ~full
15461556 with
15471557 | None -> regularCompletions
@@ -1620,8 +1630,8 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
16201630 in
16211631 let completionsForContextPath =
16221632 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
16251635 in
16261636 completionsForContextPath
16271637 |> List. map (fun (c : Completion.t ) ->
0 commit comments