Learn With Me: Elixir - Visual Studio Code and Elixir (#70)
Some people love their tools and spend many hours learning and configuring their tools. I am not one of those people. I tend to pick something that's good enough, pick up just enough to start using it, and then gradually learn more about it over time as I use it.
When I first started learning Elixir, I didn't have any particular tool that I used. I mainly just used a simple text editor on whatever computer I happened to be using. When I started working with projects and multiple files, however, I decided that I wanted something better. I ended up trying Visual Studio Code because it was free, simple, cross-platform, and had a good plugin ecosystem. I've been writing these posts while using my Windows, MacOS, and Linux machines, so I definitely wanted something that would work on all those platforms.
I had heard some good things about Visual Studio Code from people who don't normally use Microsoft software, but I was a bit reluctant to use it. I use Visual Studio on a regular basis for C# development at work, and I found that it was great at handling Microsoft-oriented development technologies, but wasn't that great at other things. I expected Visual Studio Code to be very similar.
I found that this was not the case. Visual Studio Code is quite good for a broad range of uses. It's easy to use, the start-up time is pretty good (especially for an application built as a self-contained web application using Electron), and it has great plugin support for Elixir. Since it is an Electron app, it's fairly large (about 200MB), but I guess that's the price we pay for an easily-maintained cross-platform application. It has a lot of features, but those features are pretty good at staying out of the way, allowing me to start off with the basics.
I wanted to share what I've been using for anyone who's interested.
Visual Studio Code isn't aware of Elixir by default, but it does have a lot of extensions. I'm currently using the ElixirLS Fork extension. It is based on the ElixirLS extension, but was forked from ElixirLS when ElixirLS stopped being actively maintained. I've found that ElixirLS Fork is significantly better than the other Elixir extensions I tried for Visual Studio Code.
When I started looking at extensions, I was mainly hoping for Elixir-specific code keyword coloring and maybe a little autocomplete functionality, but it provides so much more. I get recognition of Elixir code syntax, a nice autocomplete functionality, and it appears to run some kind of compilation/analysis tool in the background every time I save the code, providing errors and warnings with the corresponding code highlighted. It can also show me documentation it pulls from Elixir code when I do things like hover the mouse cursor over a function.
Visual Studio Code integrates with git and will also give me a command line window so that I don't have to leave the tool in order to do things like running mix tasks.
I feel like I've barely scraped the surface of what Visual Studio Code can do, and that's probably just fine. I was able to become productive with very little setup time and I'm pretty happy so far.
So if you're looking for a good Elixir development editor, I can recommend Visual Studio Code with the ElixirLS Fork extension.