Elixir: Autocomplete in IEx broken (on Windows)

Created on 22 Dec 2015  路  10Comments  路  Source: elixir-lang/elixir

The documentation says

   ## Autocomplete   
   To discover all available functions for a module, type the module name 
   followed by a dot, then press tab to trigger autocomplete. For example: 
        Enum. 

but this does not work on Windows 10, neither in cmd.exe nor in ConEmu and the MSys Bash (from Git).

Most helpful comment

For the reasons that Hades32 mentioned, I'm surprised this issue remains closed.
It's an ongoing problem, and iex is (as far as I'm aware) alone with this issue.

All 10 comments

I think it only works if you start it with iex --werl. I will update the docs.

You're right, it works in the special 'werl' console...

But I can't imagine anybody wanting to use 'werl'... It's ugly as hell, doesn't integrate well with other consoles, doesn't support high-DPI and so on...

Is there no way to support this without 'werl'?

@Hades32 afaik, no. :( But I am not a windows specialist :)

I still don't know _HOW_ it works, but I now know that it _is_ possible.

The Haskel interactive compiler "ghci.exe" as TAB-completion on Windows. (When running under cmd.exe and also in Msys Bash)

So, maybe it would be worth to have a look there...

PS: My personal guess is that they don't use the systems "read line" function but a "read char" function and emulate line reading. That way they can capture the tab char...

@Hades32 any luck on your research into this issue?

Where can we start looking for a solution?

How does the autocomplete feature currently work in Linux, what's missing from Windows?

@CharlesOkwuagwu you need the terminal to emit the tab escape code whenever you press tab instead of inserting a literal tab. I am not sure what is required to make such happen on Windows. I believe they may have introduced that on Windows 10 TH2 (since they also introduced ansi escapes).

I've tested iex with the following terminals without success for auto-completion:

Native:

Emulators:

Funny thing is that IRB and Pry both work out of the box on Windows without much trouble - maybe there's something that could be done on the iex side?

terminal

For the reasons that Hades32 mentioned, I'm surprised this issue remains closed.
It's an ongoing problem, and iex is (as far as I'm aware) alone with this issue.

iex is not alone, erl is doing the same thing (under the hood it actually IS the same thing)

This behavior comes from Erlang's implementation of its ttysl driver. On unix-like systems it uses tcsetattr to configure the console and then it does its own low level i/o and line editing.

On Windows the ttysl driver talks to the Erlang Windows console. That was implemented by the Erlang/OTP team.
If you start "console" shell on windows it starts as if there is no console. It just reads/writes to stdin/stdout.

To fix this a new ttysl driver would need to be written for Windows, which uses Windows Console API under the hood.

Was this page helpful?
0 / 5 - 0 ratings