Login  Register

Re: Autoformatting extisting packages

Posted by laura on Jan 31, 2015; 10:04pm
URL: https://forum.world.st/Autoformatting-extisting-packages-tp4802539p4802982.html

@Ben 
>> would an equivalent be to be able to programmatically perform the <Format> menu item that is on the editor menu?
Thats a nice idea! I will try it.

@Paul
I wan't to reformat the methods. Not sure if you're implying that to format method's code is the responsibility of browsers, i haven't tought of it before, in that case i would agree with you.

I've found out there is a class  #RBPrettyPrintCodeRefactoring , i'll try to figure out if it would do the work

Thank for your answers!
Best,
Laura



On Fri, Jan 30, 2015 at 12:09 AM, Ben Coman <[hidden email]> wrote:
For lack of a better answer, would an equivalent be to be able to programmatically perform the <Format> menu item that is on the editor menu? 

Here is how I learnt a lot about Pharo...
1. Open the editor menu and bring up halos on the <Format> menu item.  (key modifier combination varies between OS platform)
2. Click the spanner "debug" icon and choose <inspect morph>
3. Look through all the instance vars for the message that seems to invoke the formatting.  Browse all implementors of that message adding "self halt" at the top.
4.  Execute the command and trace through how its done behind the scenes, and adapt to your requirements.

HTH, cheers -ben

On Fri, Jan 30, 2015 at 5:08 AM, Laura Risani <[hidden email]> wrote:
Hi all,

How do i apply autoformatting to existing packages? I've read somewhere that this functionality used to be at the refactoring menu, but i can't find it, don't know if it has been renamed or moved.

Best,
Laura