@@ -148,7 +148,7 @@ let rec exprToContextPath (e : Parsetree.expression) =
148
148
(match exprs with
149
149
| [] -> None
150
150
| exp :: _ -> exprToContextPath exp))
151
- | Pexp_ident {txt = Lident "|." } -> None
151
+ | Pexp_ident {txt = Lident ( "|." | "|.u" ) } -> None
152
152
| Pexp_ident {txt} -> Some (CPId (Utils. flattenLongIdent txt, Value ))
153
153
| Pexp_field (e1 , {txt = Lident name } ) -> (
154
154
match exprToContextPath e1 with
@@ -162,7 +162,7 @@ let rec exprToContextPath (e : Parsetree.expression) =
162
162
| None -> None
163
163
| Some contexPath -> Some (CPObj (contexPath, txt)))
164
164
| Pexp_apply
165
- ( {pexp_desc = Pexp_ident {txt = Lident " |." }},
165
+ ( {pexp_desc = Pexp_ident {txt = Lident ( " |." | " |.u " ) }},
166
166
[
167
167
(_, lhs);
168
168
(_, {pexp_desc = Pexp_apply (d, args); pexp_loc; pexp_attributes});
@@ -175,7 +175,7 @@ let rec exprToContextPath (e : Parsetree.expression) =
175
175
pexp_attributes;
176
176
}
177
177
| Pexp_apply
178
- ( {pexp_desc = Pexp_ident {txt = Lident " |." }},
178
+ ( {pexp_desc = Pexp_ident {txt = Lident ( " |." | " |.u " ) }},
179
179
[(_, lhs); (_, {pexp_desc = Pexp_ident id; pexp_loc; pexp_attributes})]
180
180
) ->
181
181
(* Transform away pipe with identifier *)
@@ -211,13 +211,13 @@ let completePipeChain (exp : Parsetree.expression) =
211
211
(* When the left side of the pipe we're completing is a function application.
212
212
Example: someArray->Js.Array2.map(v => v + 2)-> *)
213
213
| Pexp_apply
214
- ( {pexp_desc = Pexp_ident {txt = Lident " |." }},
214
+ ( {pexp_desc = Pexp_ident {txt = Lident ( " |." | " |.u " ) }},
215
215
[_; (_, {pexp_desc = Pexp_apply (d, _)})] ) ->
216
216
exprToContextPath exp |> Option. map (fun ctxPath -> (ctxPath, d.pexp_loc))
217
217
(* When the left side of the pipe we're completing is an identifier application.
218
218
Example: someArray->filterAllTheGoodStuff-> *)
219
219
| Pexp_apply
220
- ( {pexp_desc = Pexp_ident {txt = Lident " |." }},
220
+ ( {pexp_desc = Pexp_ident {txt = Lident ( " |." | " |.u " ) }},
221
221
[_; (_, {pexp_desc = Pexp_ident _; pexp_loc})] ) ->
222
222
exprToContextPath exp |> Option. map (fun ctxPath -> (ctxPath, pexp_loc))
223
223
| _ -> None
@@ -813,7 +813,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text =
813
813
scope := oldScope);
814
814
resetCurrentCtxPath oldCtxPath
815
815
| Pexp_apply
816
- ( {pexp_desc = Pexp_ident {txt = Lident " |." ; loc = opLoc}},
816
+ ( {pexp_desc = Pexp_ident {txt = Lident ( " |." | " |.u " ) ; loc = opLoc}},
817
817
[
818
818
(_, lhs);
819
819
(_, {pexp_desc = Pexp_extension _; pexp_loc = {loc_ghost = true }});
@@ -837,7 +837,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text =
837
837
setResult (Cpath (CPId (lidPath, Value )))
838
838
| Pexp_construct (lid , eOpt ) ->
839
839
let lidPath = flattenLidCheckDot lid in
840
- if debug then
840
+ if debug && lid.txt <> Lident " Function$ " then
841
841
Printf. printf " Pexp_construct %s:%s %s\n "
842
842
(lidPath |> String. concat " \n " )
843
843
(Loc. toString lid.loc)
@@ -911,7 +911,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text =
911
911
| _ -> Cpath (CPId (compNamePath, Module )))
912
912
else iterateJsxProps ~iterator jsxProps
913
913
| Pexp_apply
914
- ( {pexp_desc = Pexp_ident {txt = Lident " |." }},
914
+ ( {pexp_desc = Pexp_ident {txt = Lident ( " |." | " |.u " ) }},
915
915
[
916
916
(_, lhs);
917
917
(_, {pexp_desc = Pexp_ident {txt = Longident. Lident id; loc}});
@@ -920,13 +920,13 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text =
920
920
(* Case foo->id *)
921
921
setPipeResult ~lhs ~id |> ignore
922
922
| Pexp_apply
923
- ( {pexp_desc = Pexp_ident {txt = Lident " |." ; loc = opLoc}},
923
+ ( {pexp_desc = Pexp_ident {txt = Lident ( " |." | " |.u " ) ; loc = opLoc}},
924
924
[(_, lhs); _] )
925
925
when Loc. end_ opLoc = posCursor ->
926
926
(* Case foo-> *)
927
927
setPipeResult ~lhs ~id: " " |> ignore
928
928
| Pexp_apply
929
- ( {pexp_desc = Pexp_ident {txt = Lident " |." }},
929
+ ( {pexp_desc = Pexp_ident {txt = Lident ( " |." | " |.u " ) }},
930
930
[_; (_, {pexp_desc = Pexp_apply (funExpr, args)})] )
931
931
when (* Normally named arg completion fires when the cursor is right after the expression.
932
932
E.g in foo(~<---there
@@ -957,7 +957,8 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text =
957
957
argCompletable |> iterateFnArguments ~is Pipe:true ~args ~iterator ;
958
958
resetCurrentCtxPath oldCtxPath)
959
959
| Some argCompletable -> setResult argCompletable)
960
- | Pexp_apply ({pexp_desc = Pexp_ident {txt = Lident "|." } } , [_; _]) ->
960
+ | Pexp_apply
961
+ ({pexp_desc = Pexp_ident {txt = Lident (" |." | "|.u" )}}, [_; _]) ->
961
962
(* Ignore any other pipe. *)
962
963
()
963
964
| Pexp_apply (funExpr, args)
0 commit comments