Open jaredly opened 8 years ago
utop
does this right -- I'm looking into what they're doing, seeing if we can use it.
https://github.com/diml/utop/blob/master/src/lib/uTop_complete.cppo.ml
That might be dangerous (theres some properly weird stuff going on in translmod around setvalue/getvalue).
It shouldn't be too hard to interpret the output of parsing and maintain our own table.
One thing I have been wondering about is whether it is possible to use utop (as a library) to control the top level. It tends to follow the ocaml compiler releases and features a bit better than iocaml (ie I would love to have ppx in iocaml, but it doesnt work at the moment).
(great minds and all that!)
:D yup. it would require forking utop (it doesn't currently expose all we would want it to), unless we pretend to be emacs and connect to utop over a socket
How come you've decided to use utop rather than merlin?
merlin also has a completion API and its already available for general use through its RPC.
merlin has a completion api that works with a running repl context? this isn't just for statically analyzable completions, this is for a repl
I see. I did not appreciate this difference at first. Isn't an ipython notebook more like a buffer rather than a true repl though? And with OCaml, you shouldn't need to actually run any of the source code to generate all completions. So I'm not sure what a non "statically analyzable completion" would be.
In any case, @let-def could you please comment on this?
On 08/22, Jared Forsyth wrote:
merlin has a completion api that works with a running repl context? this isn't just for statically analyzable completions, this is for a repl
You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/andrewray/iocaml/issues/50#issuecomment-241492004
In its current state Merlin is not compatible with a REPL because of the patches applied on compiler-libs.
We are looking into making it usable for a REPL, that should happen early 2017 and will probably be exposed as a library to use on top of compiler-libs.
@rgrinberg ipython is a true repl, with a live context that you can interact with and manipulate. though you're right that you could probably figure everything out statically, utop was built for the kind of interaction that people expect from ipython
@let-def any update with the Merlin then?
I didn't implement anything directly on Merlin side yet, but @SanderSpies extracted relevant code and made a proof of concept 👍 . I have some ideas on how to improve the integration to toplevel, but I haven't had time to look at that :/.
If I define
let something
, and then execute it, I would expect that typingsom<tab>
would autocomplete tosomething
It looks like you'd need access to
toplevel_value_bindings
, which is private :( Would we be able to just grab thetoploop.ml
file and copy it into this project?