@@ -1351,14 +1351,27 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor
13511351 children
13521352 | _ -> JSXChildrenItems []
13531353 in
1354+ let compName_loc =
1355+ match compName with
1356+ | Parsetree. Lower {loc; _}
1357+ | Parsetree. QualifiedLower {loc; _}
1358+ | Parsetree. Upper {loc; _} ->
1359+ loc
1360+ in
1361+ let compName_lid = Ast_helper. longident_of_jsx_tag_name compName in
13541362 let jsxProps =
1355- CompletionJsx. extractJsxProps ~comp Name ~props ~children
1363+ CompletionJsx. extractJsxProps
1364+ ~comp Name:(Location. mkloc compName_lid compName_loc)
1365+ ~props ~children
1366+ in
1367+ let compNamePath =
1368+ flattenLidCheckDot ~jsx: true
1369+ {txt = compName_lid; loc = compName_loc}
13561370 in
1357- let compNamePath = flattenLidCheckDot ~jsx: true compName in
13581371 if debug then
13591372 Printf. printf " JSX <%s:%s %s> _children:%s\n "
13601373 (compNamePath |> String. concat " ." )
1361- (Loc. toString compName.loc )
1374+ (Loc. toString compName_loc )
13621375 (jsxProps.props
13631376 |> List. map
13641377 (fun ({name; posStart; posEnd; exp} : CompletionJsx.prop ) ->
@@ -1369,6 +1382,19 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor
13691382 (match jsxProps.childrenStart with
13701383 | None -> " None"
13711384 | Some childrenPosStart -> Pos. toString childrenPosStart);
1385+ (* If the tag name is an uppercase path and the cursor is right after a dot (e.g., <O.|),
1386+ prefer module member completion over JSX prop suggestions. *)
1387+ (match compName with
1388+ | Parsetree. Upper _ when blankAfterCursor = Some '.' ->
1389+ setResult
1390+ (Cpath
1391+ (CPId
1392+ {
1393+ loc = compName_loc;
1394+ path = compNamePath;
1395+ completionContext = Module ;
1396+ }))
1397+ | _ -> () );
13721398 let jsxCompletable =
13731399 match expr.pexp_desc with
13741400 | Pexp_jsx_element
@@ -1383,11 +1409,11 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor
13831409 | _ ->
13841410 CompletionJsx. findJsxPropsCompletable ~jsx Props
13851411 ~end Pos:(Loc. end_ expr.pexp_loc) ~pos BeforeCursor
1386- ~pos AfterCompName:(Loc. end_ compName.loc )
1412+ ~pos AfterCompName:(Loc. end_ compName_loc )
13871413 ~first CharBeforeCursorNoWhite ~char AtCursor
13881414 in
13891415 if jsxCompletable <> None then setResultOpt jsxCompletable
1390- else if compName.loc |> Loc. hasPos ~pos: posBeforeCursor then
1416+ else if compName_loc |> Loc. hasPos ~pos: posBeforeCursor then
13911417 setResult
13921418 (match compNamePath with
13931419 | [prefix] when Char. lowercase_ascii prefix.[0 ] = prefix.[0 ] ->
@@ -1396,7 +1422,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor
13961422 Cpath
13971423 (CPId
13981424 {
1399- loc = compName.loc ;
1425+ loc = compName_loc ;
14001426 path = compNamePath;
14011427 completionContext = Module ;
14021428 }))
0 commit comments