Code Formatter and blank lines in OS X [message #140773] |
Tue, 10 February 2004 12:22  |
Eclipse User |
|
|
|
Okay, first post in any open source forum, so go easy....
Build i20040127 (and several earlier iterations). In Mac OS X (Jaguar
10.2.6 to be exact), the
new Code Formatter seems to drop blank lines in some basic cases. For
example, this
contrived dummy fragment:
[crossing fingers the tabs format properly!]
---------------------------------------------------
import java.awt.*;
public class FormatTest
{
/************************************
* method_one
*
* nothing special.
************************************/
public void method_one()
{
int i = 1;
int j = 2;
for ( i = 12; i < 100; i++ )
{
if ( i % 2 == 0 )
System.out.println( "xx" );
else
System.out.println( "yy" );
j = 0;
}
} // method_one
} // class FormatTest
-----------------------------------------------------------
Turns into this:
-----------------------------------------------------------
import java.awt.*;
public class FormatTest
{
/************************************
* method_one
*
* nothing special.
************************************/
public void method_one()
{
int i = 1;
int j = 2;
for ( i = 12; i < 100; i++ )
{
if ( i % 2 == 0 )
System.out.println( "xx" );
else
System.out.println( "yy" );
j = 0;
}
} // method_one
} // class FormatTest
-----------------------------------------------------------
Note that the blank lines above the actual method code itself continue to
preserve blank lines,
and near the bottom, after the close of the constructor a blank line is
preserved. But in the
middle of straight code they seem to get slurped up.
As another clue, if you add a comment right before the J=0 line, i.e.
---------------------------------
....
else
System.out.println( "yy" );
// reset this bugger
j = 0;
....
---------------------------------
the blank line is correctly preserved.
Is it possible I'm missing some kind of interaction between the multitude
of Code Formatter
settings?
I've tried setting the [Java>Code Formatter>Blank Lines>Existing blank
lines>Number of
empty lines to preserve] to 1 and to 2 (along with changing some of the
other blank line
related settings in various combinations), but can't see to get it to
work.
Can anyone else confirm this behavior? I can't the the only OS X Eclipse
developer.... ;-)
|
|
|
|
|
|
|
|
Re: Code Formatter and blank lines in OS X [message #141077 is a reply to message #140859] |
Wed, 11 February 2004 15:41   |
Eclipse User |
|
|
|
Tom Eicher wrote:
> Dev, I guess I didn't read your original post carefully. What you are
> seeing probably reflects your formatter settings. See the "preserve
> emtpy lines" preference in the Java->Code Formatter preferences. You
> might need to create your own settings if you're using the defaults.
Hi Tom,
Sorry, but you might want to read it again.... [ducking for fear of
flying objects! :-) ]
Yes, I've tried setting that to 0, 1 and even 2 (for kicks). And various
other
combinations of other options, to no avail. Each time the formatter
is invoked it eats all the blank lines in a code block. Unless there
happens to be a comment directly below the blank line.
Can you replicate this behavior at all? Anyone there using OS X?
> -tom
> Dev wrote:
> > Tom Eicher wrote:
> >
> >
> >>see https://bugs.eclipse.org/bugs/show_bug.cgi?id=49187
> >
> >
> > From comments #19-20 on this bug it would appear that it's been addressed,
> > either in a nightly
> > or integration build. (?)
> >
> > However, today I downloaded the i20040210 8:00 integration build and the
> > slurping of blank
> > lines in the middle of methods still occurs as described in the earlier
> > post.
> >
> > Are you guys seeing this, or is it an OS X-specific issue perhaps?
> >
|
|
|
|
Powered by
FUDForum. Page generated in 0.04325 seconds