Skip to content
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

Completion doesn't find local bindings #50

Open
jaredly opened this issue Jul 1, 2016 · 11 comments
Open

Completion doesn't find local bindings #50

jaredly opened this issue Jul 1, 2016 · 11 comments

Comments

@jaredly
Copy link
Collaborator

jaredly commented Jul 1, 2016

If I define let something, and then execute it, I would expect that typing som<tab> would autocomplete to something

image

It looks like you'd need access to toplevel_value_bindings, which is private :(
Would we be able to just grab the toploop.ml file and copy it into this project?

@jaredly
Copy link
Collaborator Author

jaredly commented Jul 1, 2016

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

@andrewray
Copy link
Owner

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

@andrewray
Copy link
Owner

(great minds and all that!)

@jaredly
Copy link
Collaborator Author

jaredly commented Jul 1, 2016

: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

@rgrinberg
Copy link

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.

@jaredly
Copy link
Collaborator Author

jaredly commented Aug 22, 2016

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

@rgrinberg
Copy link

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:
#50 (comment)

@let-def
Copy link

let-def commented Aug 23, 2016

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.

@jaredly
Copy link
Collaborator Author

jaredly commented Aug 23, 2016

@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

@XVilka
Copy link

XVilka commented Jun 9, 2017

@let-def any update with the Merlin then?

@let-def
Copy link

let-def commented Jun 9, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants