gpereira

gpereira

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.

First 10 of 58 Posts Switch mode

dimitarvp

dimitarvp

Gods, this looks amazing!

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

15
Post #1
aifrak

aifrak

I just gave it a quick try. It is amazing!

At the first try, it did not work and I had to reload the window.

I would say RefactorEx should be a must have with ElixirLS for VSCode users.

Thank you for this VSCode extension!

gpereira

gpereira OP

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

12
Post #3
lucasvegi

lucasvegi

Excellent work @gpereira! It is a great satisfaction to see the work I have been doing over the last few years turning into a practical application for the community!

gpereira

gpereira OP

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:

10
Post #5
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 #6
gpereira

gpereira OP

Oh thanks, that means a lot coming from you and I’m super excited to work with the LSP team!

Eiji

Eiji

Amazing! :heart_eyes:

adolfont

adolfont

Hi, Gabriel. // fixed.. sorry
Congrats!

I wasn’t able to try RecaftorEx.
Maybe you can help me:

[Info  - 4:13:40 PM] Client is waiting server
[Error - 4:13:40 PM] Compilation error: /home/adolfo/.asdf/lib/commands/command-exec.bash: line 31: with_shim_executable: command not found

[Error - 4:13:40 PM] Refactorex client: couldn't create connection to server.
Error: Compilation error: /home/adolfo/.asdf/lib/commands/command-exec.bash: line 31: with_shim_executable: command not found

	at /mnt/windows/__LINUX/home/adolfo/.vscode/extensions/gp-pereira.refatorex-0.1.24/out/extension.js:62:20
	at ChildProcess.exithandler (node:child_process:415:7)
	at ChildProcess.emit (node:events:519:28)
	at maybeClose (node:internal/child_process:1105:16)
	at Socket.<anonymous> (node:internal/child_process:457:11)
	at Socket.emit (node:events:519:28)
	at Pipe.<anonymous> (node:net:339:12)

I am not sure it is RefactorEx fault.

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.

Where Next? Top

Trending in Announcing Top

bluzky
You may know https://ui.shadcn.com/, a UI component library for React. I really love it’s design style and components. I’ve built some co...
387 15136 120
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
shahryarjb
The Chelekom project is a library of Phoenix and LiveView components generated via Mix tasks to fit developer needs seamlessly. One of i...
New
woylie
Phoenix components for pagination, sortable tables and filter forms with Flop and (optionally) Ecto. pagination cursor pagination sorta...
New
kip
Please say hi to a new lib, Astro that aims to deliver easy-to-consume astronomy calculations of practical use. For now it only calculat...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New

Other Trending Topics Top

juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New
bartblast
Hey folks, I just published a post about Hologram’s funding and where the project goes next - the short version: Curiosum as Main Spons...
New

We're in Beta

About us Mission Statement