Open voodoos opened 2 months ago
Yes! I think that having a nice pretty printer
(ie: 'a -> 'a \n int -> int
) for "applied/specialized" function can be very useful!
Sure, you can experiment with it. No particular preference on what's the best default here.
However, in ocaml-lsp, there is no way to get that second answer since the on_hover query always consider the first enclosing.
Another idea that may or not be feasible: include a markdown link that can be followed to see the expanded definition.
In emacs / vim modes for Merlin the ability to grow / shrink enclosing has an interresting side effect: often the first two enclosing are identical but the second one shows the most general type while the second one show the specialized type.
For example, given the following code:
Querying Merlin on the usage of
f
line 2 first result in'a -> 'a
, and querying the next enclosing shows the specialized typeint -> int
. However, in ocaml-lsp, there is no way to get that second answer since the on_hover query always consider the first enclosing.I feel like I am more often interested in the specialized type because it also gives me information on the type of the actual parameters. I guess this is a matter of context and preference, but I generally find the current behavior not satisfying.
We might soon be able to use a custom query that would allow editors to reproduce the classic merlin enclosing behavior, but I am wondering whether we should change the default behavior for the on_hover query...
We could also show both types at the same time ?