Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
feihong opened this issue Jun 12, 2024 · 0 comments · Fixed by #850
Closed

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

feihong opened this issue Jun 12, 2024 · 0 comments · Fixed by #850

Comments

@feihong
Copy link
Contributor

feihong commented Jun 12, 2024

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:

  • Remove one of the props, either foo or bar
  • Remove the [@react.component] attribute

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

anmonteiro added a commit that referenced this issue Jun 23, 2024
anmonteiro added a commit that referenced this issue Jul 23, 2024
davesnx added a commit that referenced this issue Nov 18, 2024
* 'main' of github.com:/reasonml/reason-react:
  fix: type of pipeable stream to allow objects with keys (#854)
  reason-react-ppx: + lower bound in ocaml
  add missing entries to changelog
  Fix multi-child fragment (#852)
  update compiler version in makefile cmd (#851)
  Add locations-check test (#844)
  fix: re-enable failing tests + fix location tests (#850)
  test: repro #840 (#842)
  Add CSS Box Alignment Module Level 3 (#847)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant