we are working with sebastian jordan on a better rewriter.

S. 

> On 21 May 2020, at 17:17, Vitor Medina Cruz <vitormc...@gmail.com> wrote:
> 
> Interesting, I will have a look at it.
> 
> On Thu, May 21, 2020 at 11:52 AM Thierry Goubier <thierry.goub...@gmail.com 
> <mailto:thierry.goub...@gmail.com>> wrote:
> Hi Vitor,
> 
> as a matter of fact, the infrastructure for doing what you're looking
> for is already there.
> 
> The algorithm is the following:
> 
> - create a scope (something based on RBBrowserEnvironment, such as
> RBClassEnvironment or based on regexes and AND / OR operations:
> RBAndEnvironment, RBNotEnvironment, which allows for virtually
> anything, such as all #printString methods in the package X that do
> not belong to class Y)
> 
> - create a refactoring command: if it is not a pre-existing command
> such as rename class, etc..., then writing a pattern matcher is
> possible with RBTreeRewriter.
> 
> - execute the refactoring command on the environment, changing only
> for the subset of code visible in the environment.
> 
> Normally, the system browser or the search tools should automatically
> setup the environment for you, and scope accordingly most of the
> refactoring commands. As far as I know, there isn't yet a shell giving
> you the full pattern matching rewrite power, but some work was
> underway (GUI tools).
> 
> Going with the source files as you did also work...
> 
> Regards,
> 
> Thierry
> 
> Le jeu. 21 mai 2020 à 15:30, Vitor Medina Cruz <vitormc...@gmail.com 
> <mailto:vitormc...@gmail.com>> a écrit :
> >
> > Well, as it seems, there is no way of find/replacing other than inside a 
> > single method.
> >
> > As a workaround, I did the following:
> >
> > 1- Committed all my image work in progress;
> > 2- Opened the project structure in an external tool (notepad++ in this 
> > case) and did the find/replace there;
> > 3- Committed it using git command line;
> > 4- Back to the image, I did a repair repository from iceberg checking out 
> > and ignoring changes to the image (safe because I did commit everything 
> > before)
> >
> > If there are many places to change, it is worth.
> >
> > Regards,
> > Vitor
> >
> > On Tue, May 19, 2020 at 12:56 PM Vitor Medina Cruz <vitormc...@gmail.com 
> > <mailto:vitormc...@gmail.com>> wrote:
> >>
> >> Hello,
> >>
> >> Is there a way to make find replace in a class scoped way? I can do that 
> >> with finder, but I figured only with package scoping. I wanna to change 
> >> the name of a variable in multiple methods, and also I would like to regex 
> >> replace an expression also in multiple methods.
> >>
> >> Regards,
> >> Vitor
> 

--------------------------------------------
Stéphane Ducasse
http://stephane.ducasse.free.fr / http://www.pharo.org 
03 59 35 87 52
Assistant: Aurore Dalle 
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley, 
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France

Reply via email to