Feature Request: Add "replace all in selection" to find and replace (Ctrl-H)

Problem

As a Roblox developer, it is currently too hard to perform a replace within selected parts of scripts. As it currently stands, the replace all is an all or nothing affair for the entire script. Therefore, I’m proposing a new feature that allows one to select parts of a script and perform a replace all operation only on the selected portion. This will also be in line with features that other editors provide such as Notepad+, Visual Studio Code, etc… which is sorely lacking in the Roblox Studio code editor.

If part of the code needs to be changed, it’s cumbersome and detrimental to workflow to do a find and replace one at a time. It would be easier to select a block of code and do a find and replace all that is limited to the selected text.


Use Cases

Use Case 1

Bill wrote a function in Roblox Studio. Alice doesn’t like the name of one variable that Bill chose, so she selects the function, does <CTRL>-H on the keyboard to bring up the Find & Replace dialog, fills it out, then presses Replace all in Selection to change the name of the variable everywhere in the function.

Use Case 2

Alice writes a function that relies heavily on another function that is in a different module. However, the function was moved to a different module script which has a different reference name. So so she selects the function, does <CTRL>-H on the keyboard to bring up the Find & Replace dialog, fills it out, then presses Replace all in Selection to change the name of the module reference to reflect the new location of the function.

Use Case 3

Bob moves code from one module to another. This code relies on a global variable. However, a global variable in the receiving module has the same name as the one the moved code relies on, and it’s for a different purpose. So Bob creates a new global variable with the different name, selects the moved code (which consists of multiple functions), then does does <CTRL>-H on the keyboard to bring up the Find & Replace dialog, fills it out, then presses Replace all in Selection to change the name of the global variable in the moved code to the new one.


Conclusion

If Roblox is able to address this issue, it would improve my development experience because it would make using the search and replace tool much easier when one can limit the replace all to a block of selected text. As stated previously, this is in line with features that other text editors provide and is sorely lacking in Studio.

8 Likes