@@ -263,7 +263,7 @@ let findAllCompletions ~(env : QueryEnv.t) ~prefix ~exact ~namesUsed
263263 completionForExportedFields ~env ~prefix ~exact ~names Used
264264 @ completionForExportedModules ~env ~prefix ~exact ~names Used
265265
266- let processLocalValue name loc contextPath ~prefix ~exact ~env
266+ let processLocalValue name loc contextPath scope ~prefix ~exact ~env
267267 ~(localTables : LocalTables.t ) =
268268 if Utils. checkName name ~prefix ~exact then
269269 match Hashtbl. find_opt localTables.valueTable (name, Loc. start loc) with
@@ -279,14 +279,14 @@ let processLocalValue name loc contextPath ~prefix ~exact ~env
279279 }
280280 :: localTables.resultRev)
281281 | None ->
282- Log. log
283- ( Printf. sprintf " Completion Value Not Found %s loc:%s\n " name
284- (Loc. toString loc) );
282+ if ! Cfg. debugFollowCtxPath then
283+ Printf. printf " Completion Value Not Found %s loc:%s\n " name
284+ (Loc. toString loc);
285285 localTables.resultRev < -
286286 Completion. create name ~env
287287 ~kind:
288288 (match contextPath with
289- | Some contextPath -> FollowContextPath contextPath
289+ | Some contextPath -> FollowContextPath ( contextPath, scope)
290290 | None ->
291291 Value
292292 (Ctype. newconstr
@@ -622,17 +622,17 @@ let completionsGetCompletionType ~full = function
622622 | {Completion. kind = ExtractedType (typ , _ ); env} :: _ -> Some (typ, env)
623623 | _ -> None
624624
625- let rec completionsGetCompletionType2 ~debug ~full ~opens ~rawOpens ~pos ~ scope
626- = function
625+ let rec completionsGetCompletionType2 ~debug ~full ~opens ~rawOpens ~pos =
626+ function
627627 | {Completion. kind = Value typ; env} :: _
628628 | {Completion. kind = ObjLabel typ; env} :: _
629629 | {Completion. kind = Field ({typ} , _ ); env} :: _ ->
630630 Some (TypeExpr typ, env)
631- | {Completion. kind = FollowContextPath ctxPath ; env} :: _ ->
631+ | {Completion. kind = FollowContextPath ( ctxPath , scope ) ; env} :: _ ->
632632 ctxPath
633633 |> getCompletionsForContextPath ~debug ~full ~env ~exact: true ~opens
634634 ~raw Opens ~pos ~scope
635- |> completionsGetCompletionType2 ~debug ~full ~opens ~raw Opens ~pos ~scope
635+ |> completionsGetCompletionType2 ~debug ~full ~opens ~raw Opens ~pos
636636 | {Completion. kind = Type typ ; env} :: _ -> (
637637 match TypeUtils. extractTypeFromResolvedType typ ~env ~full with
638638 | None -> None
@@ -642,16 +642,16 @@ let rec completionsGetCompletionType2 ~debug ~full ~opens ~rawOpens ~pos ~scope
642642 | _ -> None
643643
644644and completionsGetTypeEnv2 ~debug (completions : Completion.t list ) ~full ~opens
645- ~rawOpens ~pos ~ scope =
645+ ~rawOpens ~pos =
646646 match completions with
647647 | {Completion. kind = Value typ ; env} :: _ -> Some (typ, env)
648648 | {Completion. kind = ObjLabel typ ; env} :: _ -> Some (typ, env)
649649 | {Completion. kind = Field ({typ} , _ ); env} :: _ -> Some (typ, env)
650- | {Completion. kind = FollowContextPath ctxPath ; env} :: _ ->
650+ | {Completion. kind = FollowContextPath ( ctxPath , scope ) ; env} :: _ ->
651651 ctxPath
652652 |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos ~env
653653 ~exact: true ~scope
654- |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~pos ~scope
654+ |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~pos
655655 | _ -> None
656656
657657and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
@@ -754,7 +754,7 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
754754 cp
755755 |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos ~env
756756 ~exact: true ~scope
757- |> completionsGetCompletionType2 ~debug ~full ~opens ~raw Opens ~pos ~scope
757+ |> completionsGetCompletionType2 ~debug ~full ~opens ~raw Opens ~pos
758758 with
759759 | Some ((TypeExpr typ | ExtractedType (Tfunction {typ} )), env ) -> (
760760 let rec reconstructFunctionType args tRet =
@@ -805,7 +805,6 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
805805 match
806806 completionsForCtxPath
807807 |> completionsGetCompletionType2 ~debug ~full ~opens ~raw Opens ~pos
808- ~scope
809808 with
810809 | Some (TypeExpr typ , env ) -> (
811810 match typ |> TypeUtils. extractRecordType ~env ~package with
@@ -839,7 +838,7 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
839838 cp
840839 |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos ~env
841840 ~exact: true ~scope
842- |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~pos ~scope
841+ |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~pos
843842 with
844843 | Some (typ , env ) -> (
845844 match typ |> TypeUtils. extractObjectType ~env ~package with
@@ -866,7 +865,7 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
866865 cp
867866 |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos ~env
868867 ~exact: true ~scope ~mode: Pipe
869- |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~pos ~scope
868+ |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~pos
870869 with
871870 | None -> []
872871 | Some (typ , envFromCompletionItem ) -> (
@@ -1031,7 +1030,7 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
10311030 path
10321031 |> getCompletionsForPath ~debug ~completion Context:Value ~exact: true
10331032 ~package ~opens ~full ~pos ~env ~scope
1034- |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~pos ~scope
1033+ |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~pos
10351034 in
10361035 let lowercaseComponent =
10371036 match pathToComponent with
@@ -1078,7 +1077,6 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
10781077 |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos ~env
10791078 ~exact: true ~scope
10801079 |> completionsGetCompletionType2 ~debug ~full ~opens ~raw Opens ~pos
1081- ~scope
10821080 with
10831081 | Some ((TypeExpr typ | ExtractedType (Tfunction {typ} )), env ) ->
10841082 (typ |> TypeUtils. getArgs ~full ~env , env)
@@ -1115,7 +1113,7 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
11151113 rootCtxPath
11161114 |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos ~env
11171115 ~exact: true ~scope
1118- |> completionsGetCompletionType2 ~debug ~full ~opens ~raw Opens ~pos ~scope
1116+ |> completionsGetCompletionType2 ~debug ~full ~opens ~raw Opens ~pos
11191117 with
11201118 | Some (typ , env ) -> (
11211119 match typ |> TypeUtils. resolveNestedPatternPath ~env ~full ~nested with
@@ -1528,7 +1526,7 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
15281526 path
15291527 |> getCompletionsForPath ~debug ~completion Context:Value ~exact: true
15301528 ~package ~opens ~full ~pos ~env ~scope
1531- |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~pos ~scope
1529+ |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~pos
15321530 in
15331531 match completable with
15341532 | Cnone -> []
@@ -1603,7 +1601,7 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
16031601 cp
16041602 |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos ~env
16051603 ~exact: true ~scope
1606- |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~pos ~scope
1604+ |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~pos
16071605 with
16081606 | Some (typ , _env ) ->
16091607 if debug then
@@ -1639,7 +1637,7 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
16391637 contextPath
16401638 |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos ~env
16411639 ~exact: true ~scope
1642- |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~pos ~scope
1640+ |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~pos
16431641 with
16441642 | Some (typ , env ) -> (
16451643 match
0 commit comments