learn-ocaml icon indicating copy to clipboard operation
learn-ocaml copied to clipboard

Wishlist for a company-like feature in learn-ocaml

Open erikmd opened this issue 7 years ago • 3 comments
trafficstars

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 Module fields 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?

erikmd avatar May 23 '18 14:05 erikmd

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.

picdc avatar May 23 '18 15:05 picdc

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...

AltGr avatar May 24 '18 10:05 AltGr

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.

AltGr avatar Jun 21 '18 10:06 AltGr