@@ -774,7 +774,7 @@ let completionsGetCompletionType ~full completions =
774774  |  _  -> None 
775775
776776let  rec  completionsGetCompletionType2  ~debug   ~full   ~opens   ~rawOpens   ~pos  
777-     completions  = 
777+     ~ cursorPath   completions  = 
778778  let  firstNonSyntheticCompletion = 
779779    List. find_opt (fun  c  -> not  c.Completion. synthetic) completions
780780  in 
@@ -787,8 +787,9 @@ let rec completionsGetCompletionType2 ~debug ~full ~opens ~rawOpens ~pos
787787  |  Some  {Completion. kind  = FollowContextPath  (ctxPath , scope ); env}  ->
788788    ctxPath
789789    |>  getCompletionsForContextPath ~debug  ~full  ~env  ~exact: true  ~opens 
790-          ~raw Opens ~pos  ~scope 
790+          ~raw Opens ~pos  ~scope   ~cursor Path 
791791    |>  completionsGetCompletionType2 ~debug  ~full  ~opens  ~raw Opens ~pos 
792+          ~cursor Path
792793  |  Some  {Completion. kind  = Type  typ ; env}  -> (
793794    match  TypeUtils. extractTypeFromResolvedType typ ~env  ~full  with 
794795    |  None  -> None 
@@ -798,7 +799,7 @@ let rec completionsGetCompletionType2 ~debug ~full ~opens ~rawOpens ~pos
798799  |  _  -> None 
799800
800801and  completionsGetTypeEnv2  ~debug   (completions  : Completion.t list ) ~full   ~opens  
801-     ~rawOpens   ~pos   = 
802+     ~rawOpens   ~pos   ~ cursorPath   = 
802803  let  firstNonSyntheticCompletion = 
803804    List. find_opt (fun  c  -> not  c.Completion. synthetic) completions
804805  in 
@@ -809,12 +810,12 @@ and completionsGetTypeEnv2 ~debug (completions : Completion.t list) ~full ~opens
809810  |  Some  {Completion. kind  = FollowContextPath  (ctxPath , scope ); env}  ->
810811    ctxPath
811812    |>  getCompletionsForContextPath ~debug  ~full  ~opens  ~raw Opens ~pos  ~env 
812-          ~exact: true  ~scope 
813-     |>  completionsGetTypeEnv2 ~debug  ~full  ~opens  ~raw Opens ~pos 
813+          ~exact: true  ~scope   ~cursor Path 
814+     |>  completionsGetTypeEnv2 ~debug  ~full  ~opens  ~raw Opens ~pos   ~cursor Path 
814815  |  _  -> None 
815816
816817and  getCompletionsForContextPath  ~debug   ~full   ~opens   ~rawOpens   ~pos   ~env   ~exact  
817-     ~scope   ?(mode  = Regular )  contextPath  = 
818+     ~scope   ?(mode  = Regular )  ~ cursorPath   contextPath  = 
818819  let  envCompletionIsMadeFrom =  env in 
819820  if  debug then 
820821    Printf. printf " ContextPath %s\n " 
@@ -847,7 +848,7 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
847848      match 
848849        cp
849850        |>  getCompletionsForContextPath ~debug  ~full  ~opens  ~raw Opens ~pos  ~env 
850-              ~exact: true  ~scope 
851+              ~exact: true  ~scope   ~cursor Path 
851852        |>  completionsGetCompletionType ~full 
852853      with 
853854      |  None  -> [] 
@@ -869,7 +870,7 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
869870    match 
870871      cp
871872      |>  getCompletionsForContextPath ~debug  ~full  ~opens  ~raw Opens ~pos  ~env 
872-            ~exact: true  ~scope 
873+            ~exact: true  ~scope   ~cursor Path 
873874      |>  completionsGetCompletionType ~full 
874875    with 
875876    |  None  -> [] 
@@ -884,7 +885,7 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
884885    match 
885886      cp
886887      |>  getCompletionsForContextPath ~debug  ~full  ~opens  ~raw Opens ~pos  ~env 
887-            ~exact: true  ~scope 
888+            ~exact: true  ~scope   ~cursor Path 
888889      |>  completionsGetCompletionType ~full 
889890    with 
890891    |  Some  (Tpromise (env , typ ), _env ) ->
@@ -934,8 +935,9 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
934935    match 
935936      cp
936937      |>  getCompletionsForContextPath ~debug  ~full  ~opens  ~raw Opens ~pos  ~env 
937-            ~exact: true  ~scope 
938+            ~exact: true  ~scope   ~cursor Path 
938939      |>  completionsGetCompletionType2 ~debug  ~full  ~opens  ~raw Opens ~pos 
940+            ~cursor Path
939941    with 
940942    |  Some  ((TypeExpr  typ  | ExtractedType  (Tfunction {typ} )), env ) -> (
941943      let  rec  reconstructFunctionType  args  tRet  = 
@@ -985,11 +987,11 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
985987    let  completionsFromCtxPath = 
986988      cp
987989      |>  getCompletionsForContextPath ~debug  ~full  ~opens  ~raw Opens ~pos  ~env 
988-            ~exact: true  ~scope 
990+            ~exact: true  ~scope   ~cursor Path 
989991    in 
990992    let  mainTypeCompletionEnv = 
991993      completionsFromCtxPath
992-       |>  completionsGetTypeEnv2 ~debug  ~full  ~opens  ~raw Opens ~pos 
994+       |>  completionsGetTypeEnv2 ~debug  ~full  ~opens  ~raw Opens ~pos   ~cursor Path 
993995    in 
994996    match  mainTypeCompletionEnv with 
995997    |  None  ->
@@ -1021,7 +1023,7 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
10211023      let  pipeCompletions = 
10221024        cpAsPipeCompletion
10231025        |>  getCompletionsForContextPath ~debug  ~full  ~opens  ~raw Opens ~pos 
1024-              ~env: envCompletionIsMadeFrom ~exact  ~scope 
1026+              ~env: envCompletionIsMadeFrom ~exact  ~scope   ~cursor Path 
10251027        |>  List. filter_map (fun  c  ->
10261028               TypeUtils. transformCompletionToPipeCompletion ~synthetic: true 
10271029                 ~env  ?posOfDot c)
@@ -1033,8 +1035,8 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
10331035    match 
10341036      cp
10351037      |>  getCompletionsForContextPath ~debug  ~full  ~opens  ~raw Opens ~pos  ~env 
1036-            ~exact: true  ~scope 
1037-       |>  completionsGetTypeEnv2 ~debug  ~full  ~opens  ~raw Opens ~pos 
1038+            ~exact: true  ~scope   ~cursor Path 
1039+       |>  completionsGetTypeEnv2 ~debug  ~full  ~opens  ~raw Opens ~pos   ~cursor Path 
10381040    with 
10391041    |  Some  (typ , env ) -> (
10401042      match  typ |>  TypeUtils. extractObjectType ~env  ~package  with 
@@ -1052,8 +1054,8 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
10521054    match 
10531055      cp
10541056      |>  getCompletionsForContextPath ~debug  ~full  ~opens  ~raw Opens ~pos  ~env 
1055-            ~exact: true  ~scope  ~mode: Pipe 
1056-       |>  completionsGetTypeEnv2 ~debug  ~full  ~opens  ~raw Opens ~pos 
1057+            ~exact: true  ~scope  ~mode: Pipe   ~cursor Path 
1058+       |>  completionsGetTypeEnv2 ~debug  ~full  ~opens  ~raw Opens ~pos   ~cursor Path 
10571059    with 
10581060    |  None  ->
10591061      if  Debug. verbose ()  then 
@@ -1180,8 +1182,18 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
11801182          |>  TypeUtils. filterPipeableFunctions ~synthetic: true  ~env  ~full 
11811183               ~target TypeId:mainTypeId
11821184        in 
1185+         (*  Add completions from current fully qualified path module *) 
1186+         let  currentFullyQualifiedPathModuleCompletions = 
1187+           [] 
1188+           (*  completionsForPipeFromCompletionPath ~envCompletionIsMadeFrom
1189+             ~opens:[] ~pos ~scope ~debug ~prefix ~env ~rawOpens ~full cursorPath 
1190+             
1191+           |> TypeUtils.filterPipeableFunctions ~synthetic:true ~env ~full 
1192+                ~targetTypeId:mainTypeId *)  
1193+         in 
11831194        jsxCompletions @  pipeCompletions @  extraCompletions
1184-         @  currentModuleCompletions @  globallyConfiguredCompletions))
1195+         @  currentModuleCompletions @  globallyConfiguredCompletions
1196+         @  currentFullyQualifiedPathModuleCompletions))
11851197  |  CTuple  ctxPaths  ->
11861198    if  Debug. verbose ()  then  print_endline " [ctx_path]--> CTuple"  ;
11871199    (*  Turn a list of context paths into a list of type expressions. *) 
@@ -1190,7 +1202,7 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
11901202      |>  List. map (fun  contextPath  ->
11911203             contextPath
11921204             |>  getCompletionsForContextPath ~debug  ~full  ~opens  ~raw Opens ~pos 
1193-                   ~env  ~exact: true  ~scope )
1205+                   ~env  ~exact: true  ~scope   ~cursor Path )
11941206      |>  List. filter_map (fun  completionItems  ->
11951207             match  completionItems with 
11961208             |  {Completion. kind  = Value  typ }  :: _  -> Some  typ
@@ -1208,7 +1220,7 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
12081220      path
12091221      |>  getCompletionsForPath ~debug  ~completion Context:Value  ~exact: true 
12101222           ~opens  ~full  ~pos  ~env  ~scope 
1211-       |>  completionsGetTypeEnv2 ~debug  ~full  ~opens  ~raw Opens ~pos 
1223+       |>  completionsGetTypeEnv2 ~debug  ~full  ~opens  ~raw Opens ~pos   ~cursor Path 
12121224    in 
12131225    let  lowercaseComponent = 
12141226      match  pathToComponent with 
@@ -1283,8 +1295,9 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
12831295      match 
12841296        functionContextPath
12851297        |>  getCompletionsForContextPath ~debug  ~full  ~opens  ~raw Opens ~pos  ~env 
1286-              ~exact: true  ~scope 
1298+              ~exact: true  ~scope   ~cursor Path 
12871299        |>  completionsGetCompletionType2 ~debug  ~full  ~opens  ~raw Opens ~pos 
1300+              ~cursor Path
12881301      with 
12891302      |  Some  ((TypeExpr  typ  | ExtractedType  (Tfunction {typ} )), env ) ->
12901303        if  Debug. verbose ()  then  print_endline " --> found function type"  ;
@@ -1330,8 +1343,9 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
13301343    match 
13311344      rootCtxPath
13321345      |>  getCompletionsForContextPath ~debug  ~full  ~opens  ~raw Opens ~pos  ~env 
1333-            ~exact: true  ~scope 
1346+            ~exact: true  ~scope   ~cursor Path 
13341347      |>  completionsGetCompletionType2 ~debug  ~full  ~opens  ~raw Opens ~pos 
1348+            ~cursor Path
13351349    with 
13361350    |  Some  (typ , env ) -> (
13371351      match  typ |>  TypeUtils. resolveNestedPatternPath ~env  ~full  ~nested  with 
@@ -1846,7 +1860,8 @@ let rec completeTypedValue ?(typeArgContext : typeArgContext option) ~rawOpens
18461860
18471861module  StringSet  =  Set. Make  (String )
18481862
1849- let  rec  processCompletable  ~debug   ~full   ~scope   ~env   ~pos   ~forHover   completable  = 
1863+ let  rec  processCompletable  ~debug   ~full   ~scope   ~env   ~pos   ~forHover   ~cursorPath  
1864+     completable  = 
18501865  if  debug then 
18511866    Printf. printf " Completable: %s\n "   (Completable. toString completable);
18521867  let  package =  full.package in 
@@ -1857,14 +1872,14 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
18571872    path
18581873    |>  getCompletionsForPath ~debug  ~completion Context:Value  ~exact: true  ~opens 
18591874         ~full  ~pos  ~env  ~scope 
1860-     |>  completionsGetTypeEnv2 ~debug  ~full  ~opens  ~raw Opens ~pos 
1875+     |>  completionsGetTypeEnv2 ~debug  ~full  ~opens  ~raw Opens ~pos   ~cursor Path 
18611876  in 
18621877  match  completable with 
18631878  |  Cnone  -> [] 
18641879  |  Cpath  contextPath  ->
18651880    contextPath
18661881    |>  getCompletionsForContextPath ~debug  ~full  ~opens  ~raw Opens ~pos  ~env 
1867-          ~exact: forHover ~scope 
1882+          ~exact: forHover ~scope   ~cursor Path 
18681883  |  Cjsx  ([id ], prefix , identsSeen ) when  String. uncapitalize_ascii id =  id -> (
18691884    (*  Lowercase JSX tag means builtin *) 
18701885    let  mkLabel  (name , typString ) = 
@@ -2115,8 +2130,8 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
21152130      match 
21162131        cp
21172132        |>  getCompletionsForContextPath ~debug  ~full  ~opens  ~raw Opens ~pos  ~env 
2118-              ~exact: true  ~scope 
2119-         |>  completionsGetTypeEnv2 ~debug  ~full  ~opens  ~raw Opens ~pos 
2133+              ~exact: true  ~scope   ~cursor Path 
2134+         |>  completionsGetTypeEnv2 ~debug  ~full  ~opens  ~raw Opens ~pos   ~cursor Path 
21202135      with 
21212136      |  Some  (typ , _env ) ->
21222137        if  debug then 
@@ -2144,15 +2159,17 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
21442159    let  fallbackOrEmpty  ?items   ()  = 
21452160      match  (fallback, items) with 
21462161      |  Some  fallback , (None  | Some  [] ) ->
2147-         fallback |>  processCompletable ~debug  ~full  ~scope  ~env  ~pos  ~for Hover
2162+         fallback
2163+         |>  processCompletable ~debug  ~full  ~scope  ~env  ~pos  ~for Hover
2164+              ~cursor Path
21482165      |  _ , Some  items  -> items
21492166      |  None , None  -> [] 
21502167    in 
21512168    match 
21522169      contextPath
21532170      |>  getCompletionsForContextPath ~debug  ~full  ~opens  ~raw Opens ~pos  ~env 
2154-            ~exact: true  ~scope 
2155-       |>  completionsGetTypeEnv2 ~debug  ~full  ~opens  ~raw Opens ~pos 
2171+            ~exact: true  ~scope   ~cursor Path 
2172+       |>  completionsGetTypeEnv2 ~debug  ~full  ~opens  ~raw Opens ~pos   ~cursor Path 
21562173    with 
21572174    |  Some  (typ , env ) -> (
21582175      match 
@@ -2200,7 +2217,7 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
22002217    match 
22012218      contextPath
22022219      |>  getCompletionsForContextPath ~debug  ~full  ~opens  ~raw Opens ~pos  ~env 
2203-            ~exact: true  ~scope 
2220+            ~exact: true  ~scope   ~cursor Path 
22042221      |>  completionsGetCompletionType ~full 
22052222    with 
22062223    |  None  ->
@@ -2301,7 +2318,7 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
23012318    let  completionsForContextPath = 
23022319      contextPath
23032320      |>  getCompletionsForContextPath ~debug  ~full  ~opens  ~raw Opens ~pos  ~env 
2304-            ~exact: forHover ~scope 
2321+            ~exact: forHover ~scope   ~cursor Path 
23052322    in 
23062323    completionsForContextPath
23072324    |>  List. map (fun  (c  : Completion.t ) ->
0 commit comments