Skip to content

Commit 25b4f3b

Browse files
committed
simplify
1 parent a3fa364 commit 25b4f3b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

analysis/src/CompletionBackEnd.ml

+9-9
Original file line numberDiff line numberDiff line change
@@ -1611,15 +1611,15 @@ let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
16111611
in
16121612
(* We add React element functions to the completion if we're in a JSX context *)
16131613
let forJsxCompletion =
1614-
match (inJsx, getTypePath typ) with
1615-
| true, Some (Path.Pident id) when Ident.name id = "int" -> Some "int"
1616-
| true, Some (Path.Pident id) when Ident.name id = "float" ->
1617-
Some "float"
1618-
| true, Some (Path.Pident id) when Ident.name id = "string" ->
1619-
Some "string"
1620-
| true, Some (Path.Pident id) when Ident.name id = "array" ->
1621-
Some "array"
1622-
| _ -> None
1614+
if inJsx then
1615+
match getTypePath typ with
1616+
| Some (Path.Pident id) when Ident.name id = "int" -> Some "int"
1617+
| Some (Path.Pident id) when Ident.name id = "float" -> Some "float"
1618+
| Some (Path.Pident id) when Ident.name id = "string" ->
1619+
Some "string"
1620+
| Some (Path.Pident id) when Ident.name id = "array" -> Some "array"
1621+
| _ -> None
1622+
else None
16231623
in
16241624
match forJsxCompletion with
16251625
| Some builtinNameToComplete

0 commit comments

Comments
 (0)