reasonml / reason-react

Reason bindings for ReactJS
https://reasonml.github.io/reason-react/
MIT License
3.25k stars 349 forks source link

Type-on-hover stops working inside components with more than one prop on OCaml 5.2 #840

Closed feihong closed 2 months ago

feihong commented 4 months ago

Here's a small example:

[@react.component]
let make = (~foo, ~bar) => {
  <div> {React.string(foo)} {bar |> string_of_int |> React.string} </div>;
};

In VS Code, if you hover over foo or bar, you get (~foo: string, ~bar: int) => React.element, which is the type signature of the function. There are at least two ways to get normal type-on-hover back:

Note that the problem isn't limited to Reason syntax, it also doesn't work with OCaml syntax:

let make ~foo  ~bar  =
  ((div ~children:[React.string foo; (bar |> string_of_int) |> React.string]
      ())
  [@JSX ]) [@@react.component ]

I created a small repo that demonstrates the problem: https://github.com/feihong/type-on-hover-bug