@@ -510,9 +510,10 @@ let getComplementaryCompletionsForTypedValue ~opens ~allFiles ~scope ~env prefix
510510 in
511511 localCompletionsWithOpens @ fileModules
512512
513- let getCompletionsForPath ~debug ~package ~opens ~allFiles ~pos ~exact ~scope
513+ let getCompletionsForPath ~debug ~package ~opens ~full ~pos ~exact ~scope
514514 ~completionContext ~env path =
515515 if debug then Printf. printf " Path %s\n " (path |> String. concat " ." );
516+ let allFiles = allFilesInPackage full.package in
516517 match path with
517518 | [] -> []
518519 | [prefix] ->
@@ -621,18 +622,17 @@ let completionsGetCompletionType ~full = function
621622 | {Completion. kind = ExtractedType (typ , _ ); env} :: _ -> Some (typ, env)
622623 | _ -> None
623624
624- let rec completionsGetCompletionType2 ~debug ~full ~opens ~rawOpens ~allFiles
625- ~ pos ~ scope = function
625+ let rec completionsGetCompletionType2 ~debug ~full ~opens ~rawOpens ~pos ~ scope
626+ = function
626627 | {Completion. kind = Value typ; env} :: _
627628 | {Completion. kind = ObjLabel typ; env} :: _
628629 | {Completion. kind = Field ({typ} , _ ); env} :: _ ->
629630 Some (TypeExpr typ, env)
630631 | {Completion. kind = FollowContextPath ctxPath ; env} :: _ ->
631632 ctxPath
632633 |> getCompletionsForContextPath ~debug ~full ~env ~exact: true ~opens
633- ~raw Opens ~all Files ~pos ~scope
634- |> completionsGetCompletionType2 ~debug ~full ~opens ~raw Opens ~all Files
635- ~pos ~scope
634+ ~raw Opens ~pos ~scope
635+ |> completionsGetCompletionType2 ~debug ~full ~opens ~raw Opens ~pos ~scope
636636 | {Completion. kind = Type typ ; env} :: _ -> (
637637 match TypeUtils. extractTypeFromResolvedType typ ~env ~full with
638638 | None -> None
@@ -642,21 +642,20 @@ let rec completionsGetCompletionType2 ~debug ~full ~opens ~rawOpens ~allFiles
642642 | _ -> None
643643
644644and completionsGetTypeEnv2 ~debug (completions : Completion.t list ) ~full ~opens
645- ~rawOpens ~allFiles ~ pos ~scope =
645+ ~rawOpens ~pos ~scope =
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)
650650 | {Completion. kind = FollowContextPath ctxPath ; env} :: _ ->
651651 ctxPath
652- |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~all Files ~pos
653- ~env ~exact: true ~scope
654- |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~all Files ~pos
655- ~scope
652+ |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos ~env
653+ ~exact: true ~scope
654+ |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~pos ~scope
656655 | _ -> None
657656
658- and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~ pos
659- ~env ~ exact ~ scope ?(mode = Regular ) contextPath =
657+ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~ env ~ exact
658+ ~scope ?(mode = Regular ) contextPath =
660659 if debug then
661660 Printf. printf " ContextPath %s\n "
662661 (Completable. contextPathToString contextPath);
@@ -702,8 +701,8 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~pos
702701 | Regular -> (
703702 match
704703 cp
705- |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~all Files
706- ~pos ~env ~ exact:true ~scope
704+ |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos ~env
705+ ~exact: true ~scope
707706 |> completionsGetCompletionType ~full
708707 with
709708 | None -> []
@@ -725,8 +724,8 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~pos
725724 | CPOption cp -> (
726725 match
727726 cp
728- |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~all Files
729- ~pos ~env ~ exact:true ~scope
727+ |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos ~env
728+ ~exact: true ~scope
730729 |> completionsGetCompletionType ~full
731730 with
732731 | None -> []
@@ -738,15 +737,14 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~pos
738737 ])
739738 | CPId (path , completionContext ) ->
740739 path
741- |> getCompletionsForPath ~debug ~package ~opens ~all Files ~pos ~exact
740+ |> getCompletionsForPath ~debug ~package ~opens ~full ~pos ~exact
742741 ~completion Context ~env ~scope
743742 | CPApply (cp , labels ) -> (
744743 match
745744 cp
746- |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~all Files
747- ~pos ~env ~exact: true ~scope
748- |> completionsGetCompletionType2 ~debug ~full ~opens ~raw Opens ~all Files
749- ~pos ~scope
745+ |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos ~env
746+ ~exact: true ~scope
747+ |> completionsGetCompletionType2 ~debug ~full ~opens ~raw Opens ~pos ~scope
750748 with
751749 | Some ((TypeExpr typ | ExtractedType (Tfunction {typ} )), env ) -> (
752750 let rec reconstructFunctionType args tRet =
@@ -785,19 +783,19 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~pos
785783 | CPField (CPId (path , Module), fieldName ) ->
786784 (* M.field *)
787785 path @ [fieldName]
788- |> getCompletionsForPath ~debug ~package ~opens ~all Files ~pos ~exact
786+ |> getCompletionsForPath ~debug ~package ~opens ~full ~pos ~exact
789787 ~completion Context:Field ~env ~scope
790788 | CPField (cp , fieldName ) -> (
791789 let completionsForCtxPath =
792790 cp
793- |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~all Files
794- ~pos ~env ~ exact:true ~scope
791+ |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos ~env
792+ ~exact: true ~scope
795793 in
796794 let extracted =
797795 match
798796 completionsForCtxPath
799- |> completionsGetCompletionType2 ~debug ~full ~opens ~raw Opens ~all Files
800- ~pos ~ scope
797+ |> completionsGetCompletionType2 ~debug ~full ~opens ~raw Opens ~pos
798+ ~scope
801799 with
802800 | Some (TypeExpr typ , env ) -> (
803801 match typ |> TypeUtils. extractRecordType ~env ~package with
@@ -829,10 +827,9 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~pos
829827 (* TODO: Also needs to support ExtractedType *)
830828 match
831829 cp
832- |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~all Files
833- ~pos ~env ~exact: true ~scope
834- |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~all Files ~pos
835- ~scope
830+ |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos ~env
831+ ~exact: true ~scope
832+ |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~pos ~scope
836833 with
837834 | Some (typ , env ) -> (
838835 match typ |> TypeUtils. extractObjectType ~env ~package with
@@ -857,10 +854,9 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~pos
857854 | CPPipe {contextPath = cp ; id = funNamePrefix ; lhsLoc; inJsx} -> (
858855 match
859856 cp
860- |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~all Files
861- ~pos ~env ~exact: true ~scope ~mode: Pipe
862- |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~all Files ~pos
863- ~scope
857+ |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos ~env
858+ ~exact: true ~scope ~mode: Pipe
859+ |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~pos ~scope
864860 with
865861 | None -> []
866862 | Some (typ , envFromCompletionItem ) -> (
@@ -960,7 +956,7 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~pos
960956 let completions =
961957 completionPath @ [funNamePrefix]
962958 |> getCompletionsForPath ~debug ~completion Context:Value ~exact: false
963- ~package ~opens ~all Files ~pos ~env ~scope
959+ ~package ~opens ~full ~pos ~env ~scope
964960 in
965961 let completions =
966962 completions
@@ -1007,8 +1003,8 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~pos
10071003 ctxPaths
10081004 |> List. map (fun contextPath ->
10091005 contextPath
1010- |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens
1011- ~all Files ~pos ~ env ~exact: true ~scope )
1006+ |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos
1007+ ~env ~exact: true ~scope )
10121008 |> List. filter_map (fun completionItems ->
10131009 match completionItems with
10141010 | {Completion. kind = Value typ } :: _ -> Some typ
@@ -1024,9 +1020,8 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~pos
10241020 let findTypeOfValue path =
10251021 path
10261022 |> getCompletionsForPath ~debug ~completion Context:Value ~exact: true
1027- ~package ~opens ~all Files ~pos ~env ~scope
1028- |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~all Files ~pos
1029- ~scope
1023+ ~package ~opens ~full ~pos ~env ~scope
1024+ |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~pos ~scope
10301025 in
10311026 let lowercaseComponent =
10321027 match pathToComponent with
@@ -1039,7 +1034,7 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~pos
10391034 match
10401035 path
10411036 |> getCompletionsForPath ~debug ~completion Context:Type ~exact: true
1042- ~package ~opens ~all Files ~pos ~env ~scope
1037+ ~package ~opens ~full ~pos ~env ~scope
10431038 with
10441039 | {kind = Type {kind = Abstract (Some (p , _ ))} } :: _ ->
10451040 (* This case happens when what we're looking for is a type alias.
@@ -1070,10 +1065,10 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~pos
10701065 let labels, env =
10711066 match
10721067 functionContextPath
1073- |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~all Files
1074- ~pos ~env ~ exact:true ~scope
1075- |> completionsGetCompletionType2 ~debug ~full ~opens ~raw Opens ~all Files
1076- ~pos ~ scope
1068+ |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos ~env
1069+ ~exact: true ~scope
1070+ |> completionsGetCompletionType2 ~debug ~full ~opens ~raw Opens ~pos
1071+ ~scope
10771072 with
10781073 | Some ((TypeExpr typ | ExtractedType (Tfunction {typ} )), env ) ->
10791074 (typ |> TypeUtils. getArgs ~full ~env , env)
@@ -1108,10 +1103,9 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~pos
11081103 | CPatternPath {rootCtxPath; nested} -> (
11091104 match
11101105 rootCtxPath
1111- |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~all Files
1112- ~pos ~env ~exact: true ~scope
1113- |> completionsGetCompletionType2 ~debug ~full ~opens ~raw Opens ~all Files
1114- ~pos ~scope
1106+ |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos ~env
1107+ ~exact: true ~scope
1108+ |> completionsGetCompletionType2 ~debug ~full ~opens ~raw Opens ~pos ~scope
11151109 with
11161110 | Some (typ , env ) -> (
11171111 match typ |> TypeUtils. resolveNestedPatternPath ~env ~full ~nested with
@@ -1416,20 +1410,19 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
14161410 let package = full.package in
14171411 let rawOpens = Scope. getRawOpens scope in
14181412 let opens = getOpens ~debug ~raw Opens ~package ~env in
1419- let allFiles = FileSet. union package.projectFiles package.dependenciesFiles in
1413+ let allFiles = allFilesInPackage package in
14201414 let findTypeOfValue path =
14211415 path
14221416 |> getCompletionsForPath ~debug ~completion Context:Value ~exact: true
1423- ~package ~opens ~all Files ~pos ~env ~scope
1424- |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~all Files ~pos
1425- ~scope
1417+ ~package ~opens ~full ~pos ~env ~scope
1418+ |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~pos ~scope
14261419 in
14271420 match completable with
14281421 | Cnone -> []
14291422 | Cpath contextPath ->
14301423 contextPath
1431- |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~all Files ~pos
1432- ~env ~ exact: forHover ~scope
1424+ |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos ~env
1425+ ~exact: forHover ~scope
14331426 | Cjsx ([id ], prefix , identsSeen ) when String. uncapitalize_ascii id = id ->
14341427 (* Lowercase JSX tag means builtin *)
14351428 let mkLabel (name , typString ) =
@@ -1486,10 +1479,9 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
14861479 let labels =
14871480 match
14881481 cp
1489- |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~all Files
1490- ~pos ~env ~exact: true ~scope
1491- |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~all Files ~pos
1492- ~scope
1482+ |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos ~env
1483+ ~exact: true ~scope
1484+ |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~pos ~scope
14931485 with
14941486 | Some (typ , _env ) ->
14951487 if debug then
@@ -1523,10 +1515,9 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
15231515 in
15241516 match
15251517 contextPath
1526- |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~all Files
1527- ~pos ~env ~exact: true ~scope
1528- |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~all Files ~pos
1529- ~scope
1518+ |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos ~env
1519+ ~exact: true ~scope
1520+ |> completionsGetTypeEnv2 ~debug ~full ~opens ~raw Opens ~pos ~scope
15301521 with
15311522 | Some (typ , env ) -> (
15321523 match
@@ -1557,8 +1548,8 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
15571548 in
15581549 match
15591550 contextPath
1560- |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~all Files
1561- ~pos ~env ~ exact:true ~scope
1551+ |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos ~env
1552+ ~exact: true ~scope
15621553 |> completionsGetCompletionType ~full
15631554 with
15641555 | None -> regularCompletions
@@ -1637,8 +1628,8 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
16371628 in
16381629 let completionsForContextPath =
16391630 contextPath
1640- |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~all Files
1641- ~pos ~env ~ exact: forHover ~scope
1631+ |> getCompletionsForContextPath ~debug ~full ~opens ~raw Opens ~pos ~env
1632+ ~exact: forHover ~scope
16421633 in
16431634 completionsForContextPath
16441635 |> List. map (fun (c : Completion.t ) ->
0 commit comments