Bug 72698 - Code Formatter needs 2blank lines at end of file to preserve it
Summary: Code Formatter needs 2blank lines at end of file to preserve it
Status: RESOLVED DUPLICATE of bug 68506
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-26 11:28 EDT by Brad Dompe CLA
Modified: 2004-08-26 15:22 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brad Dompe CLA 2004-08-26 11:28:55 EDT
Some of our files have an "incomplete last line", which causes problems for 
certain scripts. For people using Emacs, we have "Options->Editing->Newline at 
End of File" turned on.  Using Jalopy or JUnit to format, this is preserved.   
For people using Eclipse, the Code Formatter always removes the last newline. I 
tried increasing the "Preserve blank lines", but that did not fix it.

You can replicate this using the default settings. Create a new class. There 
should be a blank line after the ending }. Right click, choose Format. The 
blank line disappears. If you then view the file with a tool such as "vi", it 
will report "Incomplete last line". 

If you hit return twice at the end of the file, Eclipse leaves them alone. If 
you put 3 or more, it removes everything except the last 2. I could request 
that everyone leave 2 blank lines at the end of the file, but I think Eclipse 
should leave a single one alone.
Comment 1 Dani Megert CLA 2004-08-26 12:14:41 EDT
which build id?
Comment 2 Brad Dompe CLA 2004-08-26 12:50:23 EDT
It's been happening as long as I've used Eclipse. I briefly used 2.1.2, but 
I've primarly been on 3.0, since sometime before the first RC. I'm afraid I 
don't know the exact number. But it's been present in all the 3.0 RC builds, 
the 3.0 release and the 3.01 milestone build M20040811.
Comment 3 Olivier Thomann CLA 2004-08-26 15:22:29 EDT

*** This bug has been marked as a duplicate of 68506 ***