Autoformatting extisting packages

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

Autoformatting extisting packages

laura
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
Reply | Threaded
Open this post in threaded view
|

Re: Autoformatting extisting packages

Paul DeBruicker
If you want to reformat all the methods in a class/package/image, I don't know how to be helpful.


If you never want to see unformatted code in a browse follow the instructions I sent you in response to your question about tools.  Using the "pretty print" and "format on accept"  settings will ensure that the code you see is always formatted to your specifications in the Settings browser using the RBConfigurableFormatter.


Hope this helps

Paul



laura 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
Reply | Threaded
Open this post in threaded view
|

Re: Autoformatting extisting packages

Ben Coman
In reply to this post by laura
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

Reply | Threaded
Open this post in threaded view
|

Re: Autoformatting extisting packages

laura
@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


Reply | Threaded
Open this post in threaded view
|

Re: Autoformatting extisting packages

Ben Coman


On Sun, Feb 1, 2015 at 6:08 AM, Laura Risani <[hidden email]> wrote:
@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


I was curious to have a quick look at that and the best way is having in run in context.  But in System Browser, right clicking on the class > Analyze > Class Refs... doesn't bring up anything.  General question for the list, how do the refactoring classes get tied into the system?

cheers -ben