Refactoring and MethodFormatter?

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

Refactoring and MethodFormatter?

TimM-3
Should the refactoring tools be working in conjuction with the current
Formatter in the image? I'm trying to get my head around how it links
together.

I've written a little hack to make the current RBFormatter preserve vertical
white space (it bugs me that it doesn't do this) - and it works fine when I
press Ctrl-W in my browsers. However if I do Rename (e.g. use the
refactorer) my source get all squished down again.

Its hard to tell if this is a bug - as I'm not sure where to start working
out where all of this action takes place.

Does anyone have any tips?


Tim


Reply | Threaded
Open this post in threaded view
|

Re: Refactoring and MethodFormatter?

Ian Bartholomew-20
Tim,

> Does anyone have any tips?

Have you tried using the configurable formatter - there's an option
there that looks promising.

Go into "User Preferences"
Expand "Development System"
Expand "Formatter Class"
Select "RBConfigurableFormatter"

You should now see an expanded list of options - one of which is
"retainBlankLinesBetweenStatements"

It may not help though as I _think_ that the browser reformat command
reformats the current source (so extra blank lines may be retained)
whereas the refactoring reduces the method to a parse tree and then
formats the output of that (extra blank lines in the original source
would be lost).

Ian


Reply | Threaded
Open this post in threaded view
|

Re: Refactoring and MethodFormatter?

TimM-3
I didn't notice any of that... will check it out. thanks.

It turns out that the refactoring stuff does look like it asks a node for
#formattedCode and so the formatter participates. My problems were more to
do with my naiive implementation of vertical space preservation. Still
learned a lot mucking around in my spare time.

Tim

"Ian Bartholomew" <[hidden email]> wrote in message
news:[hidden email]...

> Tim,
>
>> Does anyone have any tips?
>
> Have you tried using the configurable formatter - there's an option there
> that looks promising.
>
> Go into "User Preferences"
> Expand "Development System"
> Expand "Formatter Class"
> Select "RBConfigurableFormatter"
>
> You should now see an expanded list of options - one of which is
> "retainBlankLinesBetweenStatements"
>
> It may not help though as I _think_ that the browser reformat command
> reformats the current source (so extra blank lines may be retained)
> whereas the refactoring reduces the method to a parse tree and then
> formats the output of that (extra blank lines in the original source would
> be lost).
>
> Ian


Reply | Threaded
Open this post in threaded view
|

Re: Refactoring and MethodFormatter?

TimM-3
In reply to this post by Ian Bartholomew-20
Hey just tried - that works really well and preserves most of what I wanted
it to.

Blair/Andy - I had a feature request logged for this, it can be removed!

My only question would be why its not setup to use this formatter right from
the start (is it too experimental?)

Tim

"Ian Bartholomew" <[hidden email]> wrote in message
news:[hidden email]...

> Tim,
>
>> Does anyone have any tips?
>
> Have you tried using the configurable formatter - there's an option there
> that looks promising.
>
> Go into "User Preferences"
> Expand "Development System"
> Expand "Formatter Class"
> Select "RBConfigurableFormatter"
>
> You should now see an expanded list of options - one of which is
> "retainBlankLinesBetweenStatements"
>
> It may not help though as I _think_ that the browser reformat command
> reformats the current source (so extra blank lines may be retained)
> whereas the refactoring reduces the method to a parse tree and then
> formats the output of that (extra blank lines in the original source would
> be lost).
>
> Ian


Reply | Threaded
Open this post in threaded view
|

Re: Refactoring and MethodFormatter?

Blair McGlashan
"TimM" <[hidden email]> wrote in message
news:[hidden email]...
> Hey just tried - that works really well and preserves most of what I
> wanted it to.
>
> Blair/Andy - I had a feature request logged for this, it can be removed!
>
> My only question would be why its not setup to use this formatter right
> from the start (is it too experimental?)

Last time I looked it could not be set up to format code in exactly the same
way as the standard formatter, generating a few minor differences. Since
we'd formatted quite a lot of the code in the system with the standard
formatter by then, we'd (a) got use to it, and (b) didn't want to record
cosmetic formatting changes as actual changes in our SCCS.

Regards

Blair