Bug 150741 - [formatter] Add option: "add new line after label"
Summary: [formatter] Add option: "add new line after label"
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.6 M6   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 303163
  Show dependency tree
 
Reported: 2006-07-15 14:20 EDT by Jimisola Laursen CLA
Modified: 2012-07-14 01:40 EDT (History)
6 users (show)

See Also:


Attachments
patch to jdt core and UI (10.44 KB, patch)
2008-01-18 06:14 EST, Brock Janiczak CLA
no flags Details | Diff
Updated patch including regression test (12.74 KB, patch)
2008-08-18 23:38 EDT, Brock Janiczak CLA
no flags Details | Diff
Updated patch for JDT/Core projects (6.89 KB, patch)
2010-02-17 09:54 EST, Frederic Fusier CLA
no flags Details | Diff
Updated patch for JDT/UI projects (5.35 KB, patch)
2010-02-17 09:55 EST, Frederic Fusier CLA
no flags Details | Diff
Proposed patch (8.48 KB, patch)
2010-02-18 05:35 EST, Frederic Fusier CLA
frederic_fusier: iplog+
frederic_fusier: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jimisola Laursen CLA 2006-07-15 14:20:42 EDT
Currently:

label: for (int i = 0; i <list.length; i++)
[...]

would like to configure new line so that:

label:
for (int i = 0; i <list.length; i++)
[...]
Comment 1 Jimisola Laursen CLA 2006-08-30 12:39:40 EDT
Another example:

I have 

        LABEL:
        do
        {

        }
        while (false);

after format:

        LABEL: do
        {

        }
        while (false);
Comment 2 Brock Janiczak CLA 2008-01-18 06:14:57 EST
Created attachment 87246 [details]
patch to jdt core and UI

I have attached a patch to add this option.  You may want to double check the javadoc and option preference keys.  Default is off.
Comment 3 Brock Janiczak CLA 2008-02-01 16:57:05 EST
Is there any chance of the attached patch being looked at by M5? (it contains API changes).
Comment 4 Olivier Thomann CLA 2008-02-01 17:25:13 EST
For M5, no. Since Monday is the warmup build.
But we could see this post M5 depending of the patch review.
Comment 5 Brock Janiczak CLA 2008-08-10 05:20:02 EDT
Any chance this will make it into the next version of Eclipse?

I can probably recreate the patch if it has gone stale.  It has been sitting for a while.
Comment 6 Jerome Lanneluc CLA 2008-08-14 09:52:48 EDT
We would need regression tests as well.
Comment 7 Frederic Fusier CLA 2008-08-18 10:11:06 EDT
(In reply to comment #5)
> Any chance this will make it into the next version of Eclipse?
> 
> I can probably recreate the patch if it has gone stale.  It has been sitting
> for a while.
> 
It would be definitely helpful as we lack of time to work on formatter...
As said Jerome, do not forget to add some JUnit tests to validate your contribution and I'll have a look on it.
Thanks

Comment 8 Brock Janiczak CLA 2008-08-18 23:38:44 EDT
Created attachment 110309 [details]
Updated patch including regression test
Comment 9 Frederic Fusier CLA 2010-02-17 09:54:47 EST
Created attachment 159312 [details]
Updated patch for JDT/Core projects
Comment 10 Frederic Fusier CLA 2010-02-17 09:55:19 EST
Created attachment 159313 [details]
Updated patch for JDT/UI projects
Comment 11 Dani Megert CLA 2010-02-17 10:25:54 EST
>Created an attachment (id=159313) [details] [diff]
>Updated patch for JDT/UI projects
Please file a separate bug against JDT UI with this patch. Thx.
Comment 12 Frederic Fusier CLA 2010-02-18 05:35:39 EST
Created attachment 159410 [details]
Proposed patch
Comment 13 Frederic Fusier CLA 2010-02-18 05:36:43 EST
(In reply to comment #11)
> Please file a separate bug against JDT UI with this patch. Thx.

Done, see bug 303163...
Comment 14 Frederic Fusier CLA 2010-02-18 05:42:02 EST
(In reply to comment #12)
> Created an attachment (id=159410) [details]
> Proposed patch

Released for 3.6M6 in HEAD stream.
Comment 15 Markus Keller CLA 2010-02-22 08:50:00 EST
DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_LABEL says:
	 *     - default:           INSERT

Shouldn't the default be DO_NOT_INSERT? That's what I actually see when running the code, so I guess you only have to fix the Javadoc and the buildnotes entry.
Comment 16 Frederic Fusier CLA 2010-02-22 09:57:21 EST
(In reply to comment #15)
> DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_LABEL says:
>      *     - default:           INSERT
> 
> Shouldn't the default be DO_NOT_INSERT? That's what I actually see when running
> the code, so I guess you only have to fix the Javadoc and the buildnotes entry.

Correct, I fixed the javadoc comment and the entry in the build notes. Thanks a lot for the feedback :-)
Comment 17 Srikanth Sankaran CLA 2010-03-09 04:18:14 EST
Verified for 3.6M6 using build I20100305-1011