@@ -148,7 +148,7 @@ let rec exprToContextPath (e : Parsetree.expression) =
148148 (match exprs with
149149 | [] -> None
150150 | exp :: _ -> exprToContextPath exp))
151- | Pexp_ident {txt = Lident "|." } -> None
151+ | Pexp_ident {txt = Lident ( "|." | "|.u" ) } -> None
152152 | Pexp_ident {txt} -> Some (CPId (Utils. flattenLongIdent txt, Value ))
153153 | Pexp_field (e1 , {txt = Lident name } ) -> (
154154 match exprToContextPath e1 with
@@ -162,7 +162,7 @@ let rec exprToContextPath (e : Parsetree.expression) =
162162 | None -> None
163163 | Some contexPath -> Some (CPObj (contexPath, txt)))
164164 | Pexp_apply
165- ( {pexp_desc = Pexp_ident {txt = Lident " |." }},
165+ ( {pexp_desc = Pexp_ident {txt = Lident ( " |." | " |.u " ) }},
166166 [
167167 (_, lhs);
168168 (_, {pexp_desc = Pexp_apply (d, args); pexp_loc; pexp_attributes});
@@ -175,7 +175,7 @@ let rec exprToContextPath (e : Parsetree.expression) =
175175 pexp_attributes;
176176 }
177177 | Pexp_apply
178- ( {pexp_desc = Pexp_ident {txt = Lident " |." }},
178+ ( {pexp_desc = Pexp_ident {txt = Lident ( " |." | " |.u " ) }},
179179 [(_, lhs); (_, {pexp_desc = Pexp_ident id; pexp_loc; pexp_attributes})]
180180 ) ->
181181 (* Transform away pipe with identifier *)
@@ -211,13 +211,13 @@ let completePipeChain (exp : Parsetree.expression) =
211211 (* When the left side of the pipe we're completing is a function application.
212212 Example: someArray->Js.Array2.map(v => v + 2)-> *)
213213 | Pexp_apply
214- ( {pexp_desc = Pexp_ident {txt = Lident " |." }},
214+ ( {pexp_desc = Pexp_ident {txt = Lident ( " |." | " |.u " ) }},
215215 [_; (_, {pexp_desc = Pexp_apply (d, _)})] ) ->
216216 exprToContextPath exp |> Option. map (fun ctxPath -> (ctxPath, d.pexp_loc))
217217 (* When the left side of the pipe we're completing is an identifier application.
218218 Example: someArray->filterAllTheGoodStuff-> *)
219219 | Pexp_apply
220- ( {pexp_desc = Pexp_ident {txt = Lident " |." }},
220+ ( {pexp_desc = Pexp_ident {txt = Lident ( " |." | " |.u " ) }},
221221 [_; (_, {pexp_desc = Pexp_ident _; pexp_loc})] ) ->
222222 exprToContextPath exp |> Option. map (fun ctxPath -> (ctxPath, pexp_loc))
223223 | _ -> None
@@ -813,7 +813,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text =
813813 scope := oldScope);
814814 resetCurrentCtxPath oldCtxPath
815815 | Pexp_apply
816- ( {pexp_desc = Pexp_ident {txt = Lident " |." ; loc = opLoc}},
816+ ( {pexp_desc = Pexp_ident {txt = Lident ( " |." | " |.u " ) ; loc = opLoc}},
817817 [
818818 (_, lhs);
819819 (_, {pexp_desc = Pexp_extension _; pexp_loc = {loc_ghost = true }});
@@ -837,7 +837,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text =
837837 setResult (Cpath (CPId (lidPath, Value )))
838838 | Pexp_construct (lid , eOpt ) ->
839839 let lidPath = flattenLidCheckDot lid in
840- if debug then
840+ if debug && lid.txt <> Lident " Function$ " then
841841 Printf. printf " Pexp_construct %s:%s %s\n "
842842 (lidPath |> String. concat " \n " )
843843 (Loc. toString lid.loc)
@@ -911,7 +911,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text =
911911 | _ -> Cpath (CPId (compNamePath, Module )))
912912 else iterateJsxProps ~iterator jsxProps
913913 | Pexp_apply
914- ( {pexp_desc = Pexp_ident {txt = Lident " |." }},
914+ ( {pexp_desc = Pexp_ident {txt = Lident ( " |." | " |.u " ) }},
915915 [
916916 (_, lhs);
917917 (_, {pexp_desc = Pexp_ident {txt = Longident. Lident id; loc}});
@@ -920,13 +920,13 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text =
920920 (* Case foo->id *)
921921 setPipeResult ~lhs ~id |> ignore
922922 | Pexp_apply
923- ( {pexp_desc = Pexp_ident {txt = Lident " |." ; loc = opLoc}},
923+ ( {pexp_desc = Pexp_ident {txt = Lident ( " |." | " |.u " ) ; loc = opLoc}},
924924 [(_, lhs); _] )
925925 when Loc. end_ opLoc = posCursor ->
926926 (* Case foo-> *)
927927 setPipeResult ~lhs ~id: " " |> ignore
928928 | Pexp_apply
929- ( {pexp_desc = Pexp_ident {txt = Lident " |." }},
929+ ( {pexp_desc = Pexp_ident {txt = Lident ( " |." | " |.u " ) }},
930930 [_; (_, {pexp_desc = Pexp_apply (funExpr, args)})] )
931931 when (* Normally named arg completion fires when the cursor is right after the expression.
932932 E.g in foo(~<---there
@@ -957,7 +957,8 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text =
957957 argCompletable |> iterateFnArguments ~is Pipe:true ~args ~iterator ;
958958 resetCurrentCtxPath oldCtxPath)
959959 | Some argCompletable -> setResult argCompletable)
960- | Pexp_apply ({pexp_desc = Pexp_ident {txt = Lident "|." } } , [_; _]) ->
960+ | Pexp_apply
961+ ({pexp_desc = Pexp_ident {txt = Lident (" |." | "|.u" )}}, [_; _]) ->
961962 (* Ignore any other pipe. *)
962963 ()
963964 | Pexp_apply (funExpr, args)
0 commit comments