This morning we released version 2.0 of intellij-elm with a major new feature: the Elm type system is now modeled directly within the editor plugin. This allows the plugin to understand the types of your Elm functions, values, and expressions, enabling some cool features:
Infer Type of Expression
Show the inferred type of any Elm expression. Press Ctrl-Shift-P to see the type of the expression under the cursor, or expand the selection to include parent expressions. demo video (11 seconds)
Type mismatches are detected and shown directly within the editor. For instance, if you try to call a function that expects a
String but you give it a
Char , an error will be shown on the bad argument. The type checking is performed immediately within the plugin—no need to wait for the Elm compiler to be launched in an external process. demo video (8 seconds)
What is IntelliJ?
IntelliJ is a powerful and free IDE built on a unique architecture. Rather than working with source code in its text form, IntelliJ parses the source code into an abstract syntax tree (AST). All functionality and refactorings are built on this AST, allowing for much more sophisticated features than normally possible in a text editor that relies on regex and find/replace.
IntelliJ comes in many flavors including the free Community Edition, WebStorm (for web devs), PyCharm (for Python devs), etc.
What is intellij-elm?
intellij-elm is an Elm language plugin for IntelliJ that I wrote in collaboration with one of my co-workers, AJ Alt. It is:
- compatibile with both Elm 0.19 and 0.18
- has built-in support for code-completion, go-to-declaration, rename support and much more
- it reads your
elm-package.jsonfiles to understand your project’s dependencies, source-dirs etc.
- it works with IntelliJ, WebStorm, PyCharm, etc.
- it is free
More info—including demo videos of unique/advanced features—can be found on the project website.
- we haven’t yet added support for parameterized Elm types (those with a type variable like
- we currently rely on functions having type annotations.
Having the type system modeled within the Elm editor plugin will allow some advanced refactorings and other features. Some of you may have seen Ravi Chugh’s elm-conf 2018 talk on structured editing. Many of these types of program transformations will be possible within a familiar text-based IDE.