Skip to content

Commit 8e461d1

Browse files
committed
simplify by skipping check on whether array contains React.element
1 parent 81a28cd commit 8e461d1

File tree

3 files changed

+117
-175
lines changed

3 files changed

+117
-175
lines changed

analysis/src/CompletionBackEnd.ml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,18 +1618,7 @@ let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
16181618
| true, Some (Path.Pident id) when Ident.name id = "string" ->
16191619
Some "string"
16201620
| true, Some (Path.Pident id) when Ident.name id = "array" ->
1621-
(* Make sure the array contains React.element *)
1622-
let isReactElementArray =
1623-
match typ |> extractType ~env ~package with
1624-
| Some (Tarray (_env, payload)) -> (
1625-
match
1626-
payload |> getTypePath |> Option.map pathIdentToString
1627-
with
1628-
| Some "React.element" -> true
1629-
| _ -> false)
1630-
| _ -> false
1631-
in
1632-
if isReactElementArray then Some "array" else None
1621+
Some "array"
16331622
| _ -> None
16341623
in
16351624
match forJsxCompletion with

analysis/tests/src/CompletionJsx.res

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ module SomeComponent = {
99
let make = (~someProp) => {
1010
let someInt = 12
1111
let someArr = [React.null]
12-
let someInvalidArr = [12]
1312
ignore(someInt)
1413
ignore(someArr)
15-
ignore(someInvalidArr)
1614
// someString->st
1715
// ^com
1816
<div>
@@ -30,8 +28,6 @@ module SomeComponent = {
3028
// ^com
3129
// {someArr->a}
3230
// ^com
33-
// {someInvalidArr->a}
34-
// ^com
3531
</div>
3632
}
3733
}

0 commit comments

Comments
 (0)