Skip to content

Commit cb1da30

Browse files
committed
Fix autocomplete of @react. as @react.component.component.
1 parent 84c2a84 commit cb1da30

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

analysis/src/NewCompletions.ml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,15 @@ let processCompletable ~findItems ~package ~rawOpens
602602
"variadic";
603603
]
604604
|> List.filter (fun decorator -> Utils.startsWith decorator prefix)
605+
|> List.map (fun decorator ->
606+
let parts = String.split_on_char '.' prefix in
607+
let len = String.length prefix in
608+
let dec2 =
609+
if List.length parts > 1 then
610+
String.sub decorator len (String.length decorator - len)
611+
else decorator
612+
in
613+
dec2)
605614
|> List.map mkDecorator
606615
| Clabel (funPath, prefix) ->
607616
let labels =

analysis/tests/src/Complete.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ let zzz = 11
5757

5858
//^com @reac
5959

60-
//^com @react.
60+
//^com @react.

analysis/tests/src/expected/Complete.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ Complete tests/src/Complete.res 56:2
549549

550550
Complete tests/src/Complete.res 58:2
551551
[{
552-
"label": "react.component",
552+
"label": "component",
553553
"kind": 4,
554554
"tags": [],
555555
"detail": "",

0 commit comments

Comments
 (0)