@@ -481,25 +481,26 @@ let completionWithParser ~debug ~path ~posCursor ~currentFile ~text =
481481 match expr.pexp_desc with
482482 | Pexp_constant _ -> setResult Cnone
483483 | Pexp_ident lid ->
484+ let lidPath = flattenLidCheckDot lid in
484485 if debug then
485486 Printf. printf " Pexp_ident %s:%s\n "
486- (Utils. flattenLongIdent lid.txt |> String. concat " ." )
487+ (lidPath |> String. concat " ." )
487488 (Loc. toString lid.loc);
488489 if lid.loc |> Loc. hasPos ~pos: posBeforeCursor then
489- let path = flattenLidCheckDot lid in
490- setResult (Cpath (CPId (path, Value )))
490+ setResult (Cpath (CPId (lidPath, Value )))
491491 | Pexp_construct (lid , eOpt ) ->
492+ let lidPath = flattenLidCheckDot lid in
492493 if debug then
493494 Printf. printf " Pexp_construct %s:%s %s\n "
494- (Utils. flattenLongIdent lid.txt |> String. concat " \n " )
495+ (lidPath |> String. concat " \n " )
495496 (Loc. toString lid.loc)
496497 (match eOpt with
497498 | None -> " None"
498499 | Some e -> Loc. toString e.pexp_loc);
499500 if
500501 eOpt = None && (not lid.loc.loc_ghost)
501502 && lid.loc |> Loc. hasPos ~pos: posBeforeCursor
502- then setResult (Cpath (CPId (flattenLidCheckDot lid , Value )))
503+ then setResult (Cpath (CPId (lidPath , Value )))
503504 | Pexp_field (e , fieldName ) -> (
504505 if debug then
505506 Printf. printf " Pexp_field %s %s:%s\n " (Loc. toString e.pexp_loc)
@@ -532,11 +533,10 @@ let completionWithParser ~debug ~path ~posCursor ~currentFile ~text =
532533 | Pexp_apply ({pexp_desc = Pexp_ident compName}, args)
533534 when Res_parsetree_viewer. isJsxExpression expr ->
534535 let jsxProps = extractJsxProps ~comp Name ~args in
536+ let compNamePath = flattenLidCheckDot ~jsx: true compName in
535537 if debug then
536538 Printf. printf " JSX <%s:%s %s> _children:%s\n "
537- (jsxProps.compName.txt
538- |> Utils. flattenLongIdent ~jsx: true
539- |> String. concat " ." )
539+ (compNamePath |> String. concat " ." )
540540 (Loc. toString compName.loc)
541541 (jsxProps.props
542542 |> List. map (fun {name; posStart; posEnd; exp} ->
@@ -553,8 +553,7 @@ let completionWithParser ~debug ~path ~posCursor ~currentFile ~text =
553553 in
554554 if jsxCompletable <> None then setResultOpt jsxCompletable
555555 else if compName.loc |> Loc. hasPos ~pos: posBeforeCursor then
556- setResult
557- (Cpath (CPId (flattenLidCheckDot ~jsx: true compName, Module )))
556+ setResult (Cpath (CPId (compNamePath, Module )))
558557 | Pexp_apply
559558 ( {pexp_desc = Pexp_ident {txt = Lident " |." }},
560559 [
@@ -646,38 +645,41 @@ let completionWithParser ~debug ~path ~posCursor ~currentFile ~text =
646645 (Loc. toString core_type.ptyp_loc);
647646 match core_type.ptyp_desc with
648647 | Ptyp_constr (lid , _args ) ->
648+ let lidPath = flattenLidCheckDot lid in
649649 if debug then
650650 Printf. printf " Ptyp_constr %s:%s\n "
651- (Utils. flattenLongIdent lid.txt |> String. concat " ." )
651+ (lidPath |> String. concat " ." )
652652 (Loc. toString lid.loc);
653653 if lid.loc |> Loc. hasPos ~pos: posBeforeCursor then
654- setResult (Cpath (CPId (flattenLidCheckDot lid , Type )))
654+ setResult (Cpath (CPId (lidPath , Type )))
655655 | _ -> () );
656656 Ast_iterator. default_iterator.typ iterator core_type
657657 in
658658 let module_expr (iterator : Ast_iterator.iterator )
659659 (me : Parsetree.module_expr ) =
660660 (match me.pmod_desc with
661661 | Pmod_ident lid when lid.loc |> Loc. hasPos ~pos: posBeforeCursor ->
662+ let lidPath = flattenLidCheckDot lid in
662663 if debug then
663664 Printf. printf " Pmod_ident %s:%s\n "
664- (Utils. flattenLongIdent lid.txt |> String. concat " ." )
665+ (lidPath |> String. concat " ." )
665666 (Loc. toString lid.loc);
666667 found := true ;
667- setResult (Cpath (CPId (flattenLidCheckDot lid , Module )))
668+ setResult (Cpath (CPId (lidPath , Module )))
668669 | _ -> () );
669670 Ast_iterator. default_iterator.module_expr iterator me
670671 in
671672 let module_type (iterator : Ast_iterator.iterator )
672673 (mt : Parsetree.module_type ) =
673674 (match mt.pmty_desc with
674675 | Pmty_ident lid when lid.loc |> Loc. hasPos ~pos: posBeforeCursor ->
676+ let lidPath = flattenLidCheckDot lid in
675677 if debug then
676678 Printf. printf " Pmty_ident %s:%s\n "
677- (Utils. flattenLongIdent lid.txt |> String. concat " ." )
679+ (lidPath |> String. concat " ." )
678680 (Loc. toString lid.loc);
679681 found := true ;
680- setResult (Cpath (CPId (flattenLidCheckDot lid , Module )))
682+ setResult (Cpath (CPId (lidPath , Module )))
681683 | _ -> () );
682684 Ast_iterator. default_iterator.module_type iterator mt
683685 in
0 commit comments