Skip to content

completion for inferior-fsharp? #184

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

Open
ghost opened this issue Aug 10, 2018 · 4 comments
Open

completion for inferior-fsharp? #184

ghost opened this issue Aug 10, 2018 · 4 comments

Comments

@ghost
Copy link

ghost commented Aug 10, 2018

Is it possible to add tab completion for inferior-fsharp, just like inferior-python or utop?

@juergenhoetzel
Copy link
Collaborator

Is it possible to add tab completion for inferior-fsharp, just like inferior-python or utop?

Yes, inferior-python rebinds TAB to interact with the inferior process (normally TAB isn't sent to the process.
I need to investigate inferior-python internals: Pull requests are always appreciated 😄 .

@jdodds
Copy link
Contributor

jdodds commented Mar 4, 2019

Yes, inferior-python rebinds TAB to interact with the inferior process (normally TAB isn't sent to the process.
I need to investigate inferior-python internals:

So what they do is use readline.set_completer and comint-redirect-ish functions to grab completions from the inferior process and then show them to the user of the REPL. Comint basically assumes everything is line-based so the best case scenario involves a bit of an awkward dance when you want to communicate with the underlying process without sending newlines.

I've made a little bit of progress on tab completion for inferior-fsharp but it's got a long way to go. I'm not familiar enough with fsharp to see the direct path to instrumenting fsi or it's completion in a similar way to python-mode and am also not familiar enough with comint-derived mode writing and process filters in general 🙃

Are we OK with longer-lived WIP PRs here? I'm happy to to provide a starting point for right now and get some eyes/feedback on things while getting a more complete set of functionality if so.

@juergenhoetzel
Copy link
Collaborator

Are we OK with longer-lived WIP PRs here? I'm happy to to provide a starting point for right now and get some eyes/feedback on things while getting a more complete set of functionality if so.

Thanks a lot for for your research: I would love to see a (WIP) PR and help out!

@iNecas
Copy link

iNecas commented Apr 16, 2019

I was looking a bit into how IFsharp is doing the the autocompletion (https://github.com/fsprojects/IfSharp/blob/74e8ec47f9f3a5a7babb54b463d648e94bdfe813/src/IfSharp.Kernel/Evaluation.fs#L159) and it seems the way to go would be to get an access to Microsoft.FSharp.Compiler.Interactive.Shell.FsiEvaluationSession.

I have not found a way how to do it from inside of fsharpi, so it rather seems we would need to create a wrapper script around the FsiEvaluationSessions, that would expose additional reflection functionality that we could use. Seems like this is the right resource that could help moving this effort forward https://fsharp.github.io/FSharp.Compiler.Service/interactive.html

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

No branches or pull requests

3 participants