[Bug] Refactoring does not respect formatting

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug] Refactoring does not respect formatting

Sean P. DeNigris
Administrator
http://code.google.com/p/pharo/issues/detail?id=2439

We are currently working on version 1.1, so please verify your issue with
the latest 1.1 Unstable version  before reporting it - we improved a lot
the system.

Pharo image: Pharo-core
Pharo core version: 1.1 #11364
Virtual machine used: Squeak 4.2.4beta1U (mac)
Class browser used (if applicable):  OBSystemBrowserAdaptor

Steps to reproduce:
1. Start with clean image
2. Install OB with:

3. Select line "(MCPackage named: 'ProjectNotNamedForRepo') unload." from following method:
    testFromSqueakSourse
        ""
       
        ImageSetup new
                installProject: 'ProjectNotNamedForRepo'
                fromRepository: 'ProjectNamedForRepo'.
               
        (MCPackage named: 'ProjectNotNamedForRepo') unload.
        SystemOrganization removeCategory: 'ProjectNotNamedForRepo'.
4. Extract method via refactor source->extract method
5. Result does not respect whitespace and formatting:
 testFromSqueakSourse
        ""

        ImageSetup new installProject: 'ProjectNotNamedForRepo' fromRepository:
'ProjectNamedForRepo'.
        self projectShouldBeInstalled.
        self shouldnt: [ Smalltalk at: #ClassInProjectNotNamedForRepo ] raise: Error.
        self extracted.
        SystemOrganization removeCategory: 'ProjectNotNamedForRepo'

Issue was discussed in 9/09 at: http://forum.world.st/Is-there-a-way-to-use-rename-
refactor-while-preserving-whitespace-formatting-in-refactored-methods-
td1302148.html#a1302148

Ideas were:
* write your own formatter that formats as you like
* implement Gwenael's changes to the RBParser and AST, which preserve code formatting
* use tools implemented in OB-Regex

Sean
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: [Bug] Refactoring does not respect formatting

Lukas Renggli
The thing is that the 'extract method' refactoring completely changes
the structure of the code. It is hard to keep the formatting in this
case without risking completely messed up source.

I suggest you try RBConfigurable formatter, for me it provides quite
good results.

Lukas

On Tuesday, May 18, 2010, Sean P. DeNigris <[hidden email]> wrote:

>
> http://code.google.com/p/pharo/issues/detail?id=2439
>
> We are currently working on version 1.1, so please verify your issue with
> the latest 1.1 Unstable version  before reporting it - we improved a lot
> the system.
>
> Pharo image: Pharo-core
> Pharo core version: 1.1 #11364
> Virtual machine used: Squeak 4.2.4beta1U (mac)
> Class browser used (if applicable):  OBSystemBrowserAdaptor
>
> Steps to reproduce:
> 1. Start with clean image
> 2. Install OB with:
>
> 3. Select line "(MCPackage named: 'ProjectNotNamedForRepo') unload." from
> following method:
>     testFromSqueakSourse
>         ""
>
>         ImageSetup new
>                 installProject: 'ProjectNotNamedForRepo'
>                 fromRepository: 'ProjectNamedForRepo'.
>
>         (MCPackage named: 'ProjectNotNamedForRepo') unload.
>         SystemOrganization removeCategory: 'ProjectNotNamedForRepo'.
> 4. Extract method via refactor source->extract method
> 5. Result does not respect whitespace and formatting:
>  testFromSqueakSourse
>         ""
>
>         ImageSetup new installProject: 'ProjectNotNamedForRepo' fromRepository:
> 'ProjectNamedForRepo'.
>         self projectShouldBeInstalled.
>         self shouldnt: [ Smalltalk at: #ClassInProjectNotNamedForRepo ] raise:
> Error.
>         self extracted.
>         SystemOrganization removeCategory: 'ProjectNotNamedForRepo'
>
> Issue was discussed in 9/09 at:
> http://forum.world.st/Is-there-a-way-to-use-rename-
> refactor-while-preserving-whitespace-formatting-in-refactored-methods-
> td1302148.html#a1302148
>
> Ideas were:
> * write your own formatter that formats as you like
> * implement Gwenael's changes to the RBParser and AST, which preserve code
> formatting
> * use tools implemented in OB-Regex
>
> Sean
> --
> View this message in context: http://forum.world.st/Bug-Refactoring-does-not-respect-formatting-tp2220567p2220567.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project