[Pharo-project] Is there a way to use rename refactor while preserving whitespace formatting in refactored methods?

T.J. Richter tjrichter at live.com
Sun Sep 20 19:20:53 EDT 2009


Lukas Renggli <renggli at ...> writes:

> 
> > Gwenael changed the RBParser and AST to preserve code formatting.
> > He never understood why nobody did look at what he did.
> 
> I looked at it. The code did not work for me at all (it broke
> everything), so I couldn't test it.
> 
> IMHO this is not something that can be just fixed by changing the
> Refactoring Browser. The refactorings are implemented as "arbitrary"
> transformations/re-compositions of the AST. For a machine (e.g. the
> parser, the rewrite-engine, etc.), it is not clear if a space or a
> comment belongs to the AST node before or after.
> 
> Lukas
> 


Hi Lukas. I'm sure for some of the more complicated refactoring tools,
delineating whitespace between tokens is difficult or maybe even impossible, but
I don't see why a renaming tool couldn't parse the source into an AST preserving
whitespace tokens as they were, then simply performing search and replace on the
relevant message send tokens, then outputting the the token sources.





More information about the Pharo-dev mailing list