[Plugin] ReFactor - Automatically Update Code After Renaming ModuleScripts!

Plugin: https://create.roblox.com/store/asset/106860573642996

Introducing ReFactor, a plugin that provides refactor renaming support for Roblox Studio!
When renaming a ModuleScript, every reference to that ModuleScript or its class will automatically be renamed to the new ModuleScript name!

Demo:


Note: This plugin only works for renaming a ModuleScript
To learn more about what refactoring does: Refactor rename - Visual Studio (Windows) | Microsoft Learn
If you don’t want a script to get refactored, type --/nofactor at the top of the script

11 Likes

Looks nice in the video. Could you also add the ability to change the name of parts, UI components and scripts in general?

This would be very complex to add because the plugin would have to interpret the code to understand when a variable is truly a reference or not, and there would be a lot more room to cause false positives when refactoring the codebase. ModuleScripts are a lot easier to deal with because you have to use require to access them, so it’s easy for the plugin to tell if a script is referencing a ModuleScript or not. (This means a singleton architecture probably won’t work with this plugin and that’s by design to avoid false positives)
This plugin is not really a one-size-fits-all solution, as it’s designed for a specific code style (which you could probably guess in the video). If you use any extensions like BTRoblox, then you should be able to download the source code for the plugin, which you are free to modify the plugin to fit your personal needs.

Would be nice if this also refactored modulescript paths, for example lets say i have this in multiple scripts:

local MyModule = require(workspace.MyModule)

And i decided to reorganize my stuff since workspace is a bad place to store modules, so i moved it to ReplicatedStorage.
Would be nice if this worked for that and changed it to:

local MyModule = require(game:GetService(“ReplicatedStorage”).MyModule)

1 Like

Sounds interesting. I will see what I can do, but I won’t promise anything. If I were to implement this feature, I would probably make ReplicateStorage its own variable though.

example:

-- before
local MyModule = require(workspace.MyModule)

--after
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local MyModule = require(ReplicatedStorage.MyModule)
1 Like