diff --git a/analysis/src/PartialParser.ml b/analysis/src/PartialParser.ml
index f660da41f..002e9b8cb 100644
--- a/analysis/src/PartialParser.ml
+++ b/analysis/src/PartialParser.ml
@@ -175,6 +175,12 @@ let findCompletable text offset =
Some (Clabel (funPath, labelPrefix))
| '@' -> Some (Cdecorator (suffix i))
| 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '.' | '_' -> loop (i - 1)
+ | ' ' when i = offset - 1 -> (
+ (* autocomplete with no id: check if inside JSX *)
+ match findJsxContext text (offset - 1) with
+ | None -> None
+ | Some componentName ->
+ Some (Cjsx (Str.split (Str.regexp_string ".") componentName, "")))
| _ -> if i = offset - 1 then None else Some (mkPath (suffix i))
in
if offset > String.length text || offset = 0 then None else loop (offset - 1)
diff --git a/analysis/tests/src/Jsx.res b/analysis/tests/src/Jsx.res
index d28ce76ec..428b797d3 100644
--- a/analysis/tests/src/Jsx.res
+++ b/analysis/tests/src/Jsx.res
@@ -10,3 +10,5 @@ let d =
//^com ",
+ "documentation": null
+ }, {
+ "label": "second",
+ "kind": 4,
+ "tags": [],
+ "detail": "option",
+ "documentation": null
+ }]
Complete tests/src/Jsx.res 10:2
[{
@@ -25,3 +49,30 @@ Complete tests/src/Jsx.res 10:2
"documentation": null
}]
+Complete tests/src/Jsx.res 12:2
+[{
+ "label": "key",
+ "kind": 4,
+ "tags": [],
+ "detail": "string",
+ "documentation": null
+ }, {
+ "label": "first",
+ "kind": 4,
+ "tags": [],
+ "detail": "string",
+ "documentation": null
+ }, {
+ "label": "fun",
+ "kind": 4,
+ "tags": [],
+ "detail": "option",
+ "documentation": null
+ }, {
+ "label": "second",
+ "kind": 4,
+ "tags": [],
+ "detail": "option",
+ "documentation": null
+ }]
+