gpereira

gpereira

RefactorEx - Effortless Elixir Refactoring in VS Code

Hello, Elixir enthusiasts! :waving_hand:

I’m thrilled to introduce RefactorEx, a new Visual Studio Code extension designed to make refactoring your Elixir projects smoother and more efficient than ever.

What is RefactorEx?

RefactorEx simplifies your Elixir development by offering intuitive code actions for a wide range of refactorings. Whether you’re extracting functions, renaming variables, or tweaking pipelines, RefactorEx lets you refactor with confidence and speed—all without leaving your editor.

:movie_camera: Check it out in action:
RefactorEx Demo

Key Features

Here are some of the many refactorings you can perform with RefactorEx:

  • Functions: Extract, inline, rename, or even convert anonymous functions to regular ones.
  • Variables & Constants: Extract, inline, or rename with ease.
  • Aliases & Guards: Expand, merge, sort, or inline them.
  • Pipelines: Introduce or remove pipes, and even add IO.inspect for debugging.

A complete list of available refactorings can be found in the documentation.

Why RefactorEx?

Refactoring is a core part of maintaining clean, readable, and maintainable code. RefactorEx began as part of my academic journey—specifically, my undergraduate thesis project (TCC), extending the research of my professor. My goal was to create something practical and valuable for the Elixir community, and I’m excited to share it with you now!

Get Started

  1. Install RefactorEx from the VS Code Marketplace.
  2. Open your Elixir project in VS Code.
  3. Highlight a code snippet or place your cursor where a refactoring is needed.
  4. Hit the lightbulb icon :light_bulb: or use the quick actions menu (Ctrl+. or Cmd+.).

Feedback and Contributions

Your feedback is invaluable! If you have suggestions, encounter issues, or want to contribute, please head over to the GitHub repository.

RefactorEx is a work of love, and I’d love to hear your thoughts as we continue to improve and expand it. Let me know how it works for your projects or if there’s a refactoring you’d love to see implemented next!

Happy coding!
gp-pereira

Notes

  1. I know there is official LSP on its way and I’m already looking into how to merge these refactorings into it.
  2. Although it was developed for VS Code, I think it should be pretty straight forward to connect it to other editors since it’s a LSP.

Most Liked

mhanberg

mhanberg

Expert LSP Core Team

Congratulations! This has been a long time coming.

I am personally proud that GenLSP was able to be used for another language server!

As we move forward with the new official LSP, I plan on working with Gabriel to integrate his refactorings into it.

Congrats again! Awesome project.

29
Post #7
zachdaniel

zachdaniel

Creator of Ash

Woah! This is awesome! We’ve built some refactor tools into igniter, our generator and project patching tool, I’m wondering if there is an opportunity to collaborate here? There is a huge intersection in what the two libraries are doing, although ours works on a sort of “virtual” file system via rewrite. Igniter is also based on sourceror.

One of our goals with igniter is to make these accessible outside of the context of an editor, so that they can be scripted, shared and standardized.

dimitarvp

dimitarvp

Gods, this looks amazing!

Any chance to have it as a NeoVim plugin? :pray:

15
Post #2

Last Post!

Kalamar

Kalamar

I managed to install it into Codium, downloading the extension file through undocumented urls, since it didn’t appear in the list of plugins.

Newbie question: how can I change the keyboard mappings? I don’t see anything related in the “Keyboard Shortcuts” window (granted, I haven’t used Codium for a long time)

Where Next?

Popular in Announcing Top

Hal9000
Here is my first stab at this. README pasted below. https://github.com/Hal9000/elixir_random Comments and critiques are welcome. Thank...
New
zorbash
I created Kitto a framework for dashboards inspired by Dashing. The distributed characteristics of Elixir and the low memory footprint...
New
versilov
Could not wait for the missing Elixir ML libraries to appear, so, I wrote one myself, taking https://github.com/sdwolfz/exlearn as a foun...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44139 214
New
mindok
What is ContEx? A pure Elixir server-side data plotting/charting library outputting SVG. It has nice barcharts in particular and works g...
New
oltarasenko
Dear Elixir community, After a year of development, bug fixes, and improvements, we are proudly ready to share the release of Crawly 0.1...
New
trisolaran
Hi! :waving_hand: I would like to present LiveSelect, a little library that I wrote to easily add a dynamic selection input to your LV f...
198 11220 107
New

Other popular topics Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 44532 311
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

We're in Beta

About us Mission Statement