ide-haskell-repl icon indicating copy to clipboard operation
ide-haskell-repl copied to clipboard

auto-complete

Open miguel-negrao opened this issue 9 years ago • 6 comments

Would be nice to get auto-complete in the repl too... :-)

miguel-negrao avatar May 21 '16 10:05 miguel-negrao

It would be, but there are some architectural quirks in Atom that prevent this from working. I didn't find a way to work around that (yet). This probably will be implemented eventually, but it will take time. Probably quite a bit of it.

lierdakil avatar May 22 '16 14:05 lierdakil

In that case, perhaps a substitute for that would be to have a command which executes the currently selected text in a normal .hs file.

miguel-negrao avatar May 23 '16 12:05 miguel-negrao

Sorry it took so long.

ide-haskell-repl v0.2.1 has two new commands:

  • ide-haskell-repl:copy-selection-to-repl-input

    Will copy selection from currently active editor to REPL input, and focus REPL input.

  • ide-haskell-repl:run-selection-in-repl

    Will run selection from currently active editor in REPL as if you typed it in REPL input and executed it.

Both commands open REPL for current file if it's not already open.

lierdakil avatar Oct 19 '16 15:10 lierdakil

I think this can use haskell-ghc-mod to complete, as inside the editor. Do you mean can not use ghc-mod to do that or just can not pass simple Tab char to ghci ? Since ghci capture Tab in a more raw manner (use win_console.h in Win32 for example, an trigger the complete action)?

It would be, but there are some architectural quirks in Atom that prevent this from working. I didn't find a way to work around that (yet). This probably will be implemented eventually, but it will take time. Probably quite a bit of it.

soiamsoNG avatar Dec 25 '16 10:12 soiamsoNG

@soiamsoNG, the problem is not making ghc-mod work. The problem is making autocompletion itself work. autocomplete-plus package (which handles autocompletion in Atom) doesn't want to play nice with a custom-built editor instance. I didn't find time to investigate what can be done about that in much detail. And while on topic, interfacing with ghci's autocompletion would be even harder, and probably extremely brittle.

lierdakil avatar Dec 28 '16 03:12 lierdakil

Okay, so basic implementation exists via #45, but there's still room for improvement. New autocomplete-plus API allows to bind autocomplete to custom text editors, so that problem is solved, for the most part. Now the issue is getting all completion info we can from ghc-mod (if available) ~~instead of~~ in addition to ghci, since ghc-mod provides more information.

lierdakil avatar Feb 19 '17 21:02 lierdakil