-
Notifications
You must be signed in to change notification settings - Fork 8
Type Enclosing Command #14
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
Conversation
c624581
to
4a3ff5c
Compare
WDYT about keeping verbosity from enclosings to enclosings? And restoring it to 0 only when re-triggering the command? (and offering a transient binding for |
I had similar thoughts when integrating the feature in vscode and I don't have a strong preference:
I mean, it's probably the best time to introduce this kind of UX changes, as long as we keep the "multiple presses on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some doc comments right now, I will try to do a more in depth-review tomorrow.
We should really pay attention to the docstring of interactive functions :-)
Co-authored-by: Ulysse <[email protected]>
05da9e5
to
c53d9a2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good to me. I have one last question about the handling of verbosity...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for considering my suggestion for the verbosity, it really will be more ergonomic!
In an ideal world, it would be nice to limit it when it calculates a type identical to the previous one (so we don't have to go back too far) but I think that can be left to another PR?
The branch exposes the
ocaml-eglot-type-enclosing
function, which displays the type of the expression under the cursor.ocaml-eglot-type-enclosing-increase-verbosity
(C-cC-t): to increase the verbosity of the type observed
ocaml-eglot-type-enclosing-grow
(C-↑): to grow theexpression
ocaml-eglot-type-enclosing-shrink
(C-↓): to shrink theexpression
ocaml-eglot-type-enclosing-copy
(C-w): to copy thetype expression to the kill-ring (clipboard)
Decisions
At present, the control of the number of fines is reset to zero each time the enclosures are varied. However calling
C-c C-t
will increase the verbosity on the current enclosing type. It's easily possible to maintain verbosity control by ‘requests’ if you think that's better (which I don't).More
Currently, there are no queries to ask for the type of an identifier (initially usable with the prefix argument in Merlin, ie:
C-u C-c C-t
will ask for an identifier,List.map
and will display('a -> “b) -> ”a list -> ’b list
.But as it's possible to search by type, I'm not sure that the feature is ‘so necessary’.