pharo-project / pharo

Pharo is a dynamic reflective pure object-oriented language supporting live programming inspired by Smalltalk.
http://pharo.org
Other
1.21k stars 356 forks source link

[RB] Add bulk renaming refactoring #17296

Open Gabriel-Darbord opened 1 month ago

Gabriel-Darbord commented 1 month ago

I would like to be able to rename methods and classes in bulk. Methods to be renamed can be selected through the GUI, or by matching a substring/pattern (such as in the 'Choose method' window). A simple approach would be to replace a substring with another.

Later, it would be interesting to enable regex translation: do(.*?)Using: -> \l$1Using: \l$1 refers to the first matching group with $1, where the first letter is converted to lower case with \l.

doRunUsing: -> runUsing:
doExecuteUsing: -> executeUsing:

However the current regex package does not support this syntax, it is only possible using the String >> #copyWithRegex:matchesTranslatedUsing: which takes a block, but then you might as well write a script rather than use a refactoring.

Gabriel-Darbord commented 1 month ago

There is already:

However they seem to work through scripts only. The new 'Choose method' window in Pharo 13 could be a good base for an interface.

image