learn-ocaml
learn-ocaml copied to clipboard
Wishlist for a company-like feature in learn-ocaml
Dear learn-ocaml developers,
Would it be easy to implement in learn-ocaml some auto-complete feature, similar to that of company Emacs mode?
In particular, a feature that would be very convenient would be:
- for writing a qualified identifier
Module. …, - when one types the dot,
- learn-ocaml will display a menu with the list of the
Modulefields and their type... - and we could select one item using the mouse (or ↑ ↓ Enter).
(see this screenshot for an example in Emacs+Tuareg+Merlin+Company context)
What do you think about this?
I think it has been experimented at a time using Merlin, for the first session of the MOOC. If I recall correctly, Merlin was a bit heavy at that time to be embedded into the client, and Ace (the JS editor used) not ready for such auto-completion.
But actually this is a feature we would like to implement in the future.
Indeed; merlin turned out to be a little heavy-weight for that purpose (although enabling it could give quite a few other benefits, like inline typing of (sub-)expressions!) ; but we are considering bringing in ocp-index, which is much lighter-weight. The big difference is that ocp-index will only search the available libraries, and not include values defined in the current module, or even locally bound (let..in) identifiers; but that's where completion is most useful.
Handling the UI widgets is another difficult question though...
Side-note: ocaml-jupyter has support for Merlin, but since it's just a cilent for a fully server-side solution, they just had to implement a proxy to the Merlin server. Including the full Merlin in Javascript is another story.
On the UI side, the latest version of Ace (which is now the one used) seems to have fairly decent support for completion drop-downs, etc.