IntelliJ Elixir, the Elixir plugin for JetBrains IDEs (IntelliJ IDEA, RubyMine, WebStorm, etc), version 10.1.0 was released on November 8, 2018. Let’s see what’s new.
Help > IntelliJ Elixir Help
mix hex.docs online LIBRARY
is a super useful mix
task for opening the hexdocs.pm for a LIBRARY
in your browser, and it opens the docs for the library used in your mix.lock
file. With this, you don’t have to go through the wasted time and frustration of looking at the docs for the latest version of the library (https://hexdocs.pm/LIBRARY
) when you’re still using an older version and should have used the versioned URL (https://hexdocs.pm/LIBRARY/VERSION
).
I liked the automatic version opening of mix hex.docs online
and I wanted something similar for IntelliJ Elixir, because some users in the past have been confused that a feature mentioned in the README when they go to [https://github.com/KronicDeth/intellij-elixir](https://github.com/KronicDeth/intellij-elixir) isn’t in their installed version. This happens because that README is the master
README and can reflect unreleased code. What users really want is to open the README for their version, such as https://github.com/KronicDeth/intellij-elixir/blob/v10.1.0/README.md, but that involves”
- Users knowing they want a different version than
master.
- Users knowing they can switch versions using the Tags dropdown on GitHub.
Mirroring what IntelliJ itself does, I’ve added an entry to the Help menu, IntelliJ Elixir Help, that will take you to the help for the version of the plugin you have installed. The link that is opened is tied to the tag for the build, so this versioned link doesn’t just link to the last stable release, but to canary releases if you’ve opted in to downloading those, too.
ExUnit.Case
template
With each new release of IntelliJ Elixir, the list of features that could have bugs grows as does the backlog of potential features. I normally start each new release picking one feature to focus on, and then once that’s done, triaging the bugs to see if any of them are from features introduced in the last release and that I have some idea how to fix. Because of this process, I’m often looking at the first page of issues on GitHub, which show the latest issues first. I tried to prevent myself from only doing features that I’ve just thought of by going to the very earliest issues that are still open and grabbing those every few releases.
The issue requesting ExUnit.Case
templates was opened in November 2015. It was opened after a community-contributed pull request that added templates and many other things that became the totality of v1.1.0 in July 2015. Because the first templates were community-contributed, I left the issue alone, thinking another community-contributed pull request would add it, but it never happened, so I decided to add it in v10.1.0.
defmodule ${NAME} do
use ExUnit.Case
alias ${SOURCE_NAME}
@moduletag :capture_log
doctest ${ALIAS}
test "module exists" do
assert is_list(${ALIAS}.module_info())
end
end
It’s different than how I would have made it in 2015:
- It includes
@module_tag :capture_log
because I find the logs on failures feature ofExUnit
so useful now for integration tests and I didn’t have the need for them in my work in 2015 - It includes
doctest
because I try to write tests whenever possible after writingalembic
- It doesn’t include the normal
assert 1 + 1 == 2
test because I always end up deleting that one and the stub test at least checks that the module exists.
Like the other file templates, the ExUnit.Case
template is available from the context menu:
- Right-click your project’s
test
directory in the Project Pane. - Select File > Elixir File
- Change the Kind dropdown from “Empty module” to “ExUnit.Case”.
- Fill in the Name. Make sure it ends in
Test
to follow themix test
search rules. - Click OK.
Installation
You can install IntelliJ Elixir v10.1.0 from inside any of the support JetBrains IDEs. I recommend using IntelliJ IDEA (Community or Ultimate) edition if you’re using umbrella projects, as only it can support the new multi-module project features.
DockYard is a digital product agency offering exceptional user experience, design, full stack engineering, web app development, custom software, Ember, Elixir, and Phoenix services, consulting, and training.