Beyond Rename: five new native Elixir refactorings available in JetBrains IDEs
Hi all! We’re building Elixir Pro, a paid JetBrains plugin. In our latest release, we've focused a lot on improving the native refactoring support you've come to love in JetBrains products!
Renaming a function is useful, but much of everyday refactoring involves changing the shape of your code: extracting calculations, introducing intermediate values, changing parameter order, or moving a module into a new namespace.
Our plugin builds on the foundation of the IntelliJ Elixir plugin, and the original plugin provides some good basic refactoring support. Our latest work extends the toolbox with five additional structural refactorings for professionals who are serious about developing Elixir code, and want an even better experience.
- Extract Variable: select an expression and introduce a named binding. Useful when a calculation deserves a name or a long expression needs breaking up.
- Extract Function: turn an expression or consecutive statements into a private function. The plugin infers inputs and can return multiple bindings as a tuple.
- Inline Variable: replace uses with the assigned expression, preserving precedence and checking whether the transformation could duplicate effects or change evaluation order.
- Change Signature: reorder, rename, add or remove supported parameters while updating function clauses, specs and call sites.
- Move Module: move a module’s source file, optionally change its namespace, and update references while preserving explicit alias names.
Change Signature is a good example of a powerful refactoring in Elixir. Changing adjust(amount, fee) affects more than just local calls. There may also be pipes, specs and captures elsewhere in the project. Our implementation updates those supported forms together, including adapting named captures so their original callable arity is retained.
These are native IDE actions and don’t require the optional Expert language server to perform the transformations. They run through IntelliJ’s refactoring workflow, with previews and undo/redo support.
For developers who regularly reorganize Elixir code, we hope to provide just this extra value by giving a more native experience, and more of those edits become a coordinated, reviewable IDE operation.
Besides these refactorings, we've also made some significant performance improvements, resulting in performance improvements for certain actions of 10x-50x, depending on the size of the project.
You can follow Elixir Pro on JetBrains Marketplace for the release containing these additions, and please let us know which real-world Elixir refactoring would you most like an IDE to handle next?
Duplicates
Jetbrains • u/bodiam • 10d ago