iex autocomplete for variables

144 views
Skip to first unread message

andrei sura

unread,
Oct 4, 2017, 5:57:39 AM10/4/17
to elixir-lang-core

I am new to elixir and still learning about using iex.
For python there is this nice package called bpython which recognizes the type of a variable and can suggest functions from the class.

Example:

iex> Map. +TAB ==> list of functions available in the map class
iex> x = Map.new
iex> x. + TAB ==> nothing happens ( I expected list of functions available in the map class)






Screen Shot 2017-10-04 at 5.53.32 AM.png

andrei sura

unread,
Oct 4, 2017, 6:01:49 AM10/4/17
to elixir-lang-core
I just realized that this should be probably posted on the Elixir forum instead.

José Valim

unread,
Oct 4, 2017, 6:10:58 AM10/4/17
to elixir-l...@googlegroups.com
Elixir is not an object-oriented language. You can't really do something like:

x = "foo"
x.casefold





José Valim
Founder and 
Director of R&D

--
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-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/045ba7a7-d2ae-409c-8f20-d8d8624cab12%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

OvermindDL1

unread,
Oct 4, 2017, 10:15:19 AM10/4/17
to elixir-lang-core
Hmm, although iex autocompleting something like that when it is a map, keyword list, or an atom/tuple would be quite nice and entirely doable.  PR's welcome I'm sure.  ^.^;


On Wednesday, October 4, 2017 at 4:10:58 AM UTC-6, José Valim wrote:
Elixir is not an object-oriented language. You can't really do something like:

x = "foo"
x.casefold





José Valim
Founder and 
Director of R&D

On Wed, Oct 4, 2017 at 11:57 AM, andrei sura <sura....@gmail.com> wrote:

I am new to elixir and still learning about using iex.
For python there is this nice package called bpython which recognizes the type of a variable and can suggest functions from the class.

Example:

iex> Map. +TAB ==> list of functions available in the map class
iex> x = Map.new
iex> x. + TAB ==> nothing happens ( I expected list of functions available in the map class)






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

José Valim

unread,
Oct 4, 2017, 10:31:19 AM10/4/17
to elixir-l...@googlegroups.com
We already do for maps:

iex(1)> map = %{foo: 1}
%{foo: 1}
iex(2)> map.

and atoms:

iex(1)> map = Map
Map
iex(2)> map.




José Valim
Founder and 
Director of R&D

To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/ddad8b9e-6126-4edb-a4d7-eee25bfc8c20%40googlegroups.com.

OvermindDL1

unread,
Oct 4, 2017, 1:25:44 PM10/4/17
to elixir-lang-core
Heh, I tried it on my 1.5.1 install but those did not work, however they do work in my 1.6.0-dev install, whoo!

Added recently I'm guessing?

José Valim

unread,
Oct 4, 2017, 1:50:59 PM10/4/17
to elixir-l...@googlegroups.com
I am almost sure they were added on v1.5. It is even in the CHANGELOG: https://github.com/elixir-lang/elixir/blob/v1.5/CHANGELOG.md



José Valim
Founder and 
Director of R&D

To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/fe331015-fcf5-489c-be8a-c0026981ab55%40googlegroups.com.

OvermindDL1

unread,
Oct 4, 2017, 2:02:25 PM10/4/17
to elixir-lang-core
Hmm, well I have a 1.5.2 here and:

$ iex
Interactive Elixir (1.5.2) - press Ctrl+C to exit (type h() ENTER for help)
iex> s = String
String
iex> s.

And I hit <Tab> there (repeatedly) and nothing pops up.

iex> String.

And <Tab> repeatedly and nothing pops up either..

Oh, I think this might be a Windows thing.  I have 1.5.2 installed on my Windows side (OTP 20), and I have 1.6.0-dev installed (OTP 21) on my linux side (I'm at work, 2 systems side by side).  I cannot seem to get `<Tab>` to ever popup anything in `iex` on windows...  Seems iex's autocomplete is broken there?

José Valim

unread,
Oct 4, 2017, 2:23:33 PM10/4/17
to elixir-l...@googlegroups.com
I thought autocompletion doesn't work on Windows except under --werl?



José Valim
Founder and 
Director of R&D

To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/34f4ee1b-03df-4382-bc9b-b056135207b4%40googlegroups.com.

OvermindDL1

unread,
Oct 4, 2017, 2:41:26 PM10/4/17
to elixir-lang-core
Doesn't seem to in iex, and adding `--werl` just brings up this fruggin-ugly window that spams this crap:

退^[[G^[[34miex>^[[0m^[[0m  
^[[36m^[[1m^[[35mnil^[[0m^[[36m^[[1m^[[0m
^[[G^[[34miex>^[[0m^[[0m test
^[[31m** (CompileError) iex:2: undefined function test/0^[[0m
^[[31m
^[[0m^[[G^[[34miex>^[[0m^[[0m :test
^[[36m^[[1m^[[36m:test^[[0m^[[36m^[[1m^[[0m
^[[G^[[34miex>^[[0m^[[0m 

It is pretty entirely unusable, as well as it is this ugly white horror when *everything* else on both the windows and linux systems is nice and dark, in addition my shortcut keys that I use in my console exceedingly often do not work in it, unable to record sessions in it, etc... etc... etc...  `werl` is and has always been pretty horrible going back the 2 decades that I've been using erlang.

As well as other things in the command prompt have autocomplete-on-tab just fine, from being able to tab-complete folders to other programming language shells autocompleting-on-tab just fine.

Reply all
Reply to author
Forward
0 new messages