Bug 23144 - formatter issues
Summary: formatter issues
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-09-04 04:40 EDT by Kai-Uwe Maetzel CLA
Modified: 2003-10-13 12:09 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kai-Uwe Maetzel CLA 2002-09-04 04:40:41 EDT
request from 
 From: Tim Tyler <tim at tt1.org>
 Newsgroups: comp.lang.java.programmer
forwarded by Christophe Elek

:>: I like the ability to collapse internal for and while loop so you get
 a
 :>: better look at the internal architecture of a method [...]
 :>
 :> OK - after spending some time looking it doesn't seem to do that here.
 :>
 :> What's the trick?

 : Ouch ;-)
 : I should have said I personnaly like the ability of collapse... but...
 : Eclipse doesn't provide it (yet ?)
 : Sorry about that

 OK - ISWYM - no sweat.

 FWIW, one of the last editors I used was GRASP.

 This had folding - but a crummy, backwards implementation.

 What it did have that I liked was the "CSD diagram".  I miss this badly in
 every other editor I use.

 Essentially, this is an automatically-generated diagram in the left-hand
 margin of the code which reflects the structore of the code.  Method
 extent is indicated, as are loop extents, the degree to which breaks and
 continue statements break, etc, etc.  This provides much useful
 supplementary information about the code.

 It combined this with a reasonably good formatting and indenting tool.

 Eclipse's formatter is pretty simple - and makes what I consider to be
 lots of mistakes.

 I tried Jalopy - but it is no better.

 For example, they both do this:

 if (too_big)   return max;
 if (too_small) return min;
 return just_right;

 ...becomes...

 if (too_big)
   return max;
 if (too_small)
   return min;
 return just_right;

 Aside from being ugly and wasting space, I think that creates maintenance
 problems.  One-line ifs with no braces rarely cause problems - but if
 statements split over multiple lines with no braces invite the error of
 adding statements that you think are controlled by the "if" - but in fact
 are not.  Not a good move by the formatter - IMHO.

 Both formatters have the same philosophical problem.  I /mainly/ want in
 indenter to sort out my formatting problems.  Jalopy insists on
 controlling every aspect of the code.  I can't tell it to leave the code
 alone, and just change the indentation.  It insists on changing the number
 of blank lines all over the place - and of course it gets well out of its
 depth, can't be configured to do things correctly - and makes an almighty
 mess of everything :-|

 Anyway I expect I will be working through:

 http://mindprod.com/jglossbeautifier.html

 ...shortly, in search of something not /quite/ so dim.
 --
Comment 1 Olivier Thomann CLA 2003-01-15 13:22:30 EST
We need to clear 2.1 bug reports that won't be addressed before 2.1. The new 
implementation is still in the works. Therefore we cannot include it for 2.1. 
Not enough testing and we need to polish the preferences. This will be address 
for 2.2 as stated in the JDT/Core plan.
Comment 2 Philipe Mulet CLA 2003-06-12 06:35:59 EDT
Resurrecting for 3.0
Comment 3 Olivier Thomann CLA 2003-06-12 15:58:48 EDT
Reopen for 3.0 consideration.
Comment 4 Olivier Thomann CLA 2003-10-03 10:06:06 EDT
This is addressed in the new formatter with the guard clause option.
Fixed and released in HEAD.
Regression test added.
Comment 5 David Audel CLA 2003-10-13 12:09:28 EDT
Verified.