What editing tools can I use to understand Elixir better?

I think part of the problem reading and groking Elixir is because I don’t have some kind of IDE Intellisense plugins which can show me the type of objects I am looking, display some help on them and help understand the parameters and syntax better.

Are there some ViM plugins which can help with that, or for any other editors. I think I have to avoid GUI based editors as I will doing a lot of work over terminals.

1 Like

In general emacs with alchemist is capable of showing you documentation and also VS code can.

But this functionallity is very limited, it is only available fur functions and modules that can be resolved unambiguously.

Types of a “thing” (I avoid to say object for a reason!) are even harder. It is a very hard task to infer them from the context. Generating the necessary typeinformation of erlangs base applications takes about 10 minutes on my computer using dialyzer. And even after this information is available, types can get pretty complex, since the way the BEAM deals with them.

3 Likes

I would like to add that IEx is a wonderful tool, with its i, h, v and r helpers. When trying out if ideas work, I usually will write out the basic functionality in a module, then load this in an IEx session with some inputs, before deciding if this is indeed the proper way. If so, then I’ll lock it down by writing tests for it.

But especially when using third party libraries, thr ability to find out how any command works by using h is really wonderful.

2 Likes

Do you mean understanding Elixir better or your code? If you mean the code try SpaceMacs (as per our set-up guide here) - it is similar to an IDE.

If you mean Elixir itself, we are very lucky to have lots of really well-written books - you really can’t beat books when it comes to learning a language imo :slight_smile:

1 Like

I am referring to understanding the code as I read it because coming from an imperative background I find the code rather cryptic. Symbols seem to be popping up all over the place when in imperative language they will be declared and you can see what is going on.

For instance I had some trouble understanding pipes because the function calls didn’t match the signatures until I was told that expression to the left of the pipe is actually its first parameter. I think I am in my first week of getting to grips with Elixir.

Just when I thought it would be safe to go with Vim I am now told Spacemacs is the preferred option (for Elixir). I need to learn some Vim so I would prefer the Vim’s equivalent to Alchemist and evaluate Spacemacs later.

2 Likes

I would definitely pick up a book or two - you can even get 25% of any Pragprog or Manning book via the forum discount :003:

This is a good thread, if a bit old now, but still worth a look:

1 Like

I have just read about the Evil Mode in Spacemacs which makes it work like Vim.

But will Vim plugins work with it, or will it be easy to find Spacemacs/Emacs equivalents for them?

1 Like

To this, the answer is a resonant: Yes. (Spac)emacs probably has more plugins than most other editors combined :smiley:

1 Like

Don’t spend lots of time on editing tool. Just pick the one you feel good with.

About understanding the pipe operator : it is exactly how it is explained in all tutorial. Keep playing a bit with it, there tends to be really little happening in elixir. What probably happens is that you overcomplexify your explanation.

Which is normal, it is how our brain is wired :slight_smile: if it is hard to understand, it should be complex. Keep playing a bit, yoiu will probably get your mind blown a couple time :slight_smile:

3 Likes

I agree with this for the most part but once you’ve experienced perfect intellisense in full visual studio it’s very hard to go without.

I’m currently using visual studio code with vscode-elixir and it’s ok but still leaves me wanting more. You can hover the cursor over a module or function and usually shows you the documentation but it seems like a 50/50 chance it can actually find the module. The same goes for autocomplete but no docs (though it does list params) even when it works it doesn’t seem to list all functions.

The good thing is that elixir is quite a simple and well organised language. I still have keep a tab open with the elixir docs but always find what I want very easily.

2 Likes

Until you’ve experienced KDevelop and how much beyond its intellisense goes (it has clang embedded entirely, whatever other plugs can use whatever they want, but for C++ it is unmatched). :wink: