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

feature request: have a "goto type" link on hover #1198

Open
Alizter opened this issue Oct 16, 2023 · 0 comments
Open

feature request: have a "goto type" link on hover #1198

Alizter opened this issue Oct 16, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@Alizter
Copy link
Contributor

Alizter commented Oct 16, 2023

In rust-analyzer, you get the following UX:
image

Hovering over an identifier (key) shows the type, just like in OCaml. Additionally it also has a Go to <type> link that the user can click on and go to the type. It would be great to have something similar in OCaml.

  • We already have a go to type function, which should work for simple types like int.
  • Type applications like int list we could do something more fancy and display both int and list. This would require us to know the types present in a complicated type like this. Not sure if merlin can supply us with this information cc @voodoos. It is currently a shortfall of the already existing "go to type" functionality.

It seems that the hover text request is markdown so we can supply as many links as we would like. I'm thinking something like:

\```ocaml
(int, int list) result
\```

Go to:
- [result](loc of result)
  - [int](loc of int)
  - [list](loc of list)
    - [int](loc of int)  

Obviously this introduces some degree of redundancy, but the structure of the links might help users dissect the type more easily. Especially in complicated cases like format.

rust-analyzer also has a similar feature though it doesn't look like its as extensive as proposed above:
image

@Alizter Alizter changed the title feature request: "have a goto type link on hover" feature request: have a "goto type" link on hover Oct 16, 2023
@jfeser jfeser added the enhancement New feature or request label Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants