Proposal: Stop appending a trailing dot when autocompleting modules in IEx

99 views
Skip to first unread message

Myron Marston

unread,
Jun 23, 2016, 12:40:14 PM6/23/16
to elixir-lang-core

This behavior of IEx has always surprised and annoyed me. I regularly type h [first few chars of mod name]<tab><enter> in IEx to read the read the moduledoc of a particular module, and the trailing period gets in the way every time.

Here’s a demonstration showing what happens to me regularly when I try to read the @moduledoc for a module:

iex_autocomplete_original

With this change, it avoids this problem:

iex_autocomplete_improved

I opened a PR with this change but was asked to redirect conversation here for community feedback first. On the PR, @antipax said (and @josevalim concurred):

I’m not in support of merging this, if only because the vast majority of the time I autocomplete a module in IEx it is to make a remote call.

I thought the purpose of autocomplete in IEx is to autocomplete tokens (e.g. module and function names) not to guess the intention of the programmer and add additional characters after the token. IMO, it’s much more natural to just complete the module name, and people who want to do a remote call (or navigate to a “nested” module) can type a period, than to add the period and force the programmer to delete it. After all, I believe the autocomplete plugins in most text editors/IDEs would just autocomplete the module name, and not add the period.

On the PR @antipax also said:

I would be in support of making this configurable, however.

Having this be configurable would meet my needs as long as I could configure it globally (presumably in ~/.iex.exs) but the trailing dot still feels like an odd default to me.

Thoughts from the community?

Thanks,
Myron

Louis Pop

unread,
Jun 23, 2016, 12:42:53 PM6/23/16
to elixir-l...@googlegroups.com
I share Jose' opinion here, but making it configurable sounds good.

Cheers,
Louis

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CADUxQmu%3Dnc1VpF9Y8oFE%2Bzsp45Xb_sCVZjdPLgBQivrpt2iv2g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Paul Clegg

unread,
Jun 23, 2016, 12:51:02 PM6/23/16
to elixir-l...@googlegroups.com
I'm actually with Myron.  Since I haven't found a good way in iex to "cancel the current line", if I get in that spot, I lose a lot of history and current variables and whatnot.  If anything, my vote would be to make it optional -- but default it to NOT appending the dot.  I prefer UI elements that help me do what I want to do, not make presumptions about what I want to do.

...Paul



Myron Marston

unread,
Jun 23, 2016, 1:29:24 PM6/23/16
to elixir-lang-core
Since I haven't found a good way in iex to "cancel the current line", if I get in that spot, I lose a lot of history and current variables and whatnot.

I've tend to do this, too, even though I've been using Elixir as my main language at work for nearly a year.  It's a big reason I find the appended period to be so annoying.

If anything, my vote would be to make it optional -- but default it to NOT appending the dot.
 
I agree.  If we make it a config option, I think it would help newcomers to the language if we made it opt-in instead of opt-out.  Given that most auto-complete tooling does not usually add an extra period, newcomers to the language are not going to expect it, and won't know how to get out of the "current line" issue Paul mentioned without exiting the IEx session and restarting it.  Furthermore, since they are a newcomer, they are not likely to know about the config option.

OTOH, experienced users who may want the appended period will understand IEx's config system and can more easily configure it for their needs.

Myron

Aleksei Magusev

unread,
Jun 23, 2016, 1:59:22 PM6/23/16
to elixir-lang-core
I'm wondering, what if we go with combined approach:
at first TAB we're getting autocomplete up to the "dot"
and next TAB is appending the "dot".

I believe it can be a good compromise. :)

Myron Marston

unread,
Jun 23, 2016, 2:01:36 PM6/23/16
to elixir-lang-core
I like this idea :).

--
You received this message because you are subscribed to a topic in the Google Groups "elixir-lang-core" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elixir-lang-core/ZDbAdRgCvzw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/386bdd96-d3e0-4b90-8172-a5bbe51a1246%40googlegroups.com.

Paul Clegg

unread,
Jun 23, 2016, 2:11:40 PM6/23/16
to elixir-l...@googlegroups.com
I can get behind this as a no-config-option compromise.  :)

...Paul



On Thu, Jun 23, 2016 at 10:59 AM, Aleksei Magusev <lex...@gmail.com> wrote:

José Valim

unread,
Jun 23, 2016, 2:15:46 PM6/23/16
to elixir-l...@googlegroups.com
Sounds good to me too!



José Valim
Skype: jv.ptec
Founder and Director of R&D

Eric E.

unread,
Jun 23, 2016, 3:11:41 PM6/23/16
to elixir-lang-core, jose....@plataformatec.com.br
I like it as well.

Also for those looking for a way to "cancel the current line" in iex, you can type #iex:break at any time to return to do so.

Josh Adams

unread,
Jun 23, 2016, 3:32:24 PM6/23/16
to elixir-l...@googlegroups.com, José Valim
Also for those looking for a way to "cancel the current line" in iex, you can type #iex:break at any time to return to do so.

This is super useful to know.  And I know it.  And I still never use it because I don't think about until it's too late.  And I've been using Elixir, and known about this, for years.  I think no beginner will ever find out about it or use it! :) 

Eric Entin

unread,
Jun 23, 2016, 3:35:10 PM6/23/16
to elixir-l...@googlegroups.com
Agreed on all points.

Just thought I'd mention it. :)

--
You received this message because you are subscribed to a topic in the Google Groups "elixir-lang-core" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elixir-lang-core/ZDbAdRgCvzw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAA1-O0x4S8vdZM%2BF7u4kqVqUwSpsPh%2BoQ9xd2FO6XDCo86yQXQ%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages