Skip to content

Commit 45d4378

Browse files
committed
Handle nested component assigned to a prop without braces.
1 parent 2e4011c commit 45d4378

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

analysis/src/PartialParser.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ let skipOptVariant text i =
6969
Find JSX context ctx for component M to autocomplete id (already parsed) as a prop.
7070
ctx ::= <M args id
7171
arg ::= id | id = [?] val
72-
val ::= id | "abc" | 42 | optVariant {...} | optVariant (...) | [...]
72+
val ::= id | "abc" | 42 | optVariant {...} | optVariant (...) | <...> | [...]
7373
optVariant ::= a | A | #a | #A | _nothing_
7474
*)
7575
let findJsxContext text offset =
@@ -83,6 +83,9 @@ let findJsxContext text offset =
8383
| ')' ->
8484
let i1 = findBackSkippingCommentsAndStrings text '(' ')' (i - 1) 0 in
8585
if i1 > 0 then beforeParen identsSeen i1 else None
86+
| '>' ->
87+
let i1 = findBackSkippingCommentsAndStrings text '<' '>' (i - 1) 0 in
88+
if i1 > 0 then beforeValue identsSeen i1 else None
8689
| ']' ->
8790
let i1 = findBackSkippingCommentsAndStrings text '[' ']' (i - 1) 0 in
8891
if i1 > 0 then beforeValue identsSeen i1 else None

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,11 @@ skipOptIdent
111111
}]
112112

113113
Complete tests/src/Jsx.res 26:2
114-
[]
114+
[{
115+
"label": "key",
116+
"kind": 4,
117+
"tags": [],
118+
"detail": "string",
119+
"documentation": null
120+
}]
115121

0 commit comments

Comments
 (0)