[3.0M9] Formatter not obeying tabs vs. spaces settings? [message #165873] |
Fri, 25 June 2004 14:02 |
Eclipse User |
|
|
|
Originally posted by: eclipse.rizzoweb.com
I am working with an existing code base that, unfortunately, uses an
inconsistent mixture of tabs and spaces for indentation.
So as I touch various files, I am trying to re-format them to use tabs
consistently. Problem is, the formatter is not doing what I expect when
I re-format existing code.
Here's an example method that is formatted weirdly:
<sp><sp><sp><sp>public void foo()
<sp><sp><sp><sp>{
<tab>doSomething();
<tab>doSomethingElse();
<tab>}
Which looks like this:
public void foo()
{
soSomething();
doSomethingElse();
}
I select this code and tell Eclipse to format it. I would expect it to
translate the space indentation on the first two lines to tab
indentation (my options are set up to always prefer tabs for
indentation). However, it leaves the spaces indenting the first two lines.
Is this intended behavior? If my formatter options say use tabs for
indentation, why is it leaving the spaces?
I recognize that the formatter and its options have changed a lot since
2.x, so I want to know if this is a bug or if there might be some other
options to try tweaking.
TIA,
Eric
|
|
|
Re: [3.0M9] Formatter not obeying tabs vs. spaces settings? [message #165890 is a reply to message #165873] |
Fri, 25 June 2004 14:34 |
Tom Hofmann Messages: 770 Registered: July 2009 |
Senior Member |
|
|
Did you just format the selected method, or the entire file (ie. did you
have a selection when invoking 'Format'?)?
Not quite sure, but: if you just select the method for formatting, the
formatter may not necessarily change the initial indentation. Try
formatting the entire file.
-tom
Eric Rizzo wrote:
> I am working with an existing code base that, unfortunately, uses an
> inconsistent mixture of tabs and spaces for indentation.
> So as I touch various files, I am trying to re-format them to use tabs
> consistently. Problem is, the formatter is not doing what I expect when
> I re-format existing code.
> Here's an example method that is formatted weirdly:
>
> <sp><sp><sp><sp>public void foo()
> <sp><sp><sp><sp>{
> <tab>doSomething();
> <tab>doSomethingElse();
> <tab>}
>
> Which looks like this:
> public void foo()
> {
> soSomething();
> doSomethingElse();
> }
>
>
> I select this code and tell Eclipse to format it. I would expect it to
> translate the space indentation on the first two lines to tab
> indentation (my options are set up to always prefer tabs for
> indentation). However, it leaves the spaces indenting the first two lines.
> Is this intended behavior? If my formatter options say use tabs for
> indentation, why is it leaving the spaces?
> I recognize that the formatter and its options have changed a lot since
> 2.x, so I want to know if this is a bug or if there might be some other
> options to try tweaking.
>
> TIA,
> Eric
|
|
|
Re: [3.0M9] Formatter not obeying tabs vs. spaces settings? [message #166089 is a reply to message #165890] |
Mon, 28 June 2004 22:07 |
Eclipse User |
|
|
|
Originally posted by: eclipse.rizzoweb.com
Tom Eicher wrote:
> Did you just format the selected method, or the entire file (ie. did you
> have a selection when invoking 'Format'?)?
>
> Not quite sure, but: if you just select the method for formatting, the
> formatter may not necessarily change the initial indentation. Try
> formatting the entire file.
Yes, this is only a problem when formatting the selection as opposed to
the entire file. I guess what I want to know is if this is "intended"
(ie, there is a justification for it being this way). If not, I'll file
a bug for it.
Eric
|
|
|
|
Powered by
FUDForum. Page generated in 0.03404 seconds