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

Creator of elixir-tools

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.

28
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
gpereira

gpereira

Yeah, I intend to work on it in the next weeks

12
Post #4
gpereira

gpereira

You’re one of the main inspirations for this project and without your groundwork it would have taken way longer to build it, so I can’t thank you enough. :handshake:

Where Next?

Popular in Libraries Top

josevalim
Hi everyone, We would like to announce that Plataformatec is working on a new MySQL driver called MyXQL. Our goal is to eventually integ...
New
deadtrickster
I’ve just released stable versions of my Prometheus Elixir libs: Elixir client [docs]; Ecto collector [docs]; Plugs instrumenter/Export...
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
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
markmark206
simple_feature_flags is a tiny package that lets you turn features on or off based on which environment (e.g. localhost, staging, product...
New
nikokozak
Hello all, I’ve been working on Svonix - a library for quickly integrating Svelte components into Phoenix views. It’s a much-needed succ...
New
cjen07
parameterized pipe in elixir: |n> edit: negative index in |n> and mixed usage with |> are supported example: use ParamP...
New
wfgilman
I’ve cleaned up and open sourced three financial libraries I was using for my company. They are bindings for the APIs of these three comp...
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
New

Other popular topics Top

itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New

Sub Categories:

We're in Beta

About us Mission Statement