Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Code Formatter and blank lines in OS X
Code Formatter and blank lines in OS X [message #140773] Tue, 10 February 2004 12:22 Go to next message
Eclipse UserFriend
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 #140783 is a reply to message #140773] Tue, 10 February 2004 12:27 Go to previous messageGo to next message
Eclipse UserFriend
Grrr. Looks like the tabs expanded to 8 (!) spaces, and various invisible
carriage returns found
their way into the text body. Sorry about that, but I don't see a way to
edit my post.
Re: Code Formatter and blank lines in OS X [message #140794 is a reply to message #140773] Tue, 10 February 2004 12:47 Go to previous messageGo to next message
Eclipse UserFriend
see https://bugs.eclipse.org/bugs/show_bug.cgi?id=49187
Re: Code Formatter and blank lines in OS X [message #140804 is a reply to message #140794] Tue, 10 February 2004 14:14 Go to previous messageGo to next message
Eclipse UserFriend
Tom Eicher wrote:

> see https://bugs.eclipse.org/bugs/show_bug.cgi?id=49187


Ack! Really? I did see that bug, but it didn't look (to an outsider)
like it was directly related to
this problem. But if you say so I'll believe you. ;-)

And as soon as the latest integration build is ready I'll download it and
try again.
Re: Code Formatter and blank lines in OS X [message #140815 is a reply to message #140794] Tue, 10 February 2004 17:41 Go to previous messageGo to next message
Eclipse UserFriend
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?
Re: Code Formatter and blank lines in OS X [message #140859 is a reply to message #140815] Wed, 11 February 2004 03:12 Go to previous messageGo to next message
Eclipse UserFriend
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.

-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?
>
Re: Code Formatter and blank lines in OS X [message #141077 is a reply to message #140859] Wed, 11 February 2004 15:41 Go to previous messageGo to next message
Eclipse UserFriend
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?
> >
Re: Code Formatter and blank lines in OS X [message #141088 is a reply to message #141077] Wed, 11 February 2004 15:54 Go to previous message
Eclipse UserFriend
Originally posted by: olivier_thomann.ca.ibm.comNOSPAM

Le Wed, 11 Feb 2004 20:41:04 +0000 (UTC), zoo464@yahoo.com (Dev) a
écrit :
>Can you replicate this behavior at all? Anyone there using OS X?
I opened https://bugs.eclipse.org/bugs/show_bug.cgi?id=51768 to track
it down.
--
Olivier
Previous Topic:override project property page
Next Topic:[CodeFormatter] Enable Comment Formatting
Goto Forum:
  


Current Time: Tue Jul 22 13:07:44 EDT 2025

Powered by FUDForum. Page generated in 0.04325 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top