Bug 27196 - Code Formatter Won't Indent Braces
Summary: Code Formatter Won't Indent Braces
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0.2   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-26 16:57 EST by Forest CLA
Modified: 2009-08-30 02:37 EDT (History)
0 users

See Also:


Attachments
Code formatter settings under 3.1M2 (25.23 KB, text/plain)
2004-10-06 18:08 EDT, Sean Kirby CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Forest CLA 2002-11-26 16:57:52 EST
I want my code to look like this:

if (foo)
   {
   bar();
   }

Note that braces are not only on their own lines, but indented to line up with
the code they contain.  The code formatter preferences don't offer this option.
Comment 1 Olivier Thomann CLA 2003-01-15 13:22:57 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:38 EDT
Resurrecting for 3.0
Comment 3 Olivier Thomann CLA 2003-06-12 15:58:53 EDT
Reopen for 3.0 consideration.
Comment 4 Olivier Thomann CLA 2003-10-03 10:10:56 EDT
This is addressed in the new formatter.
Fixed and released in HEAD.
Regression test added.
Comment 5 David Audel CLA 2003-10-13 12:17:38 EDT
Verified.
Comment 6 Malcolm Langille CLA 2004-09-29 12:30:48 EDT
I have looked and looked in the code formatter but cannot find this feature?

if (foo)
   {
   bar();
   }

I want the braces indented to line up with the code they contain?
Comment 7 Olivier Thomann CLA 2004-10-05 18:17:46 EDT
Could you please provide your formatter preferences? Attach them to this bug report.
Comment 8 Sean Kirby CLA 2004-10-06 18:07:02 EDT
This has been working for me since 2.1.  Check the 'Braces' tab and set the drop
downs to 'Next line indented'.

What doesn't seem to work for me is the the following:

obj.addPropertyChangeListener(new PropertyChangeListener()
	{
		public void propertyChange(PropertyChangeEvent arg0)
			{
			// TODO Auto-generated method stub
			}
	});


When it should be:

obj.addPropertyChangeListener(new PropertyChangeListener()
	{
	public void propertyChange(PropertyChangeEvent arg0)
		{
		// TODO Auto-generated method stub
		}
	});
Comment 9 Sean Kirby CLA 2004-10-06 18:08:58 EDT
Created attachment 15029 [details]
Code formatter settings under 3.1M2

Code formatter settings to reproduce formatting in previous post
Comment 10 Philipe Mulet CLA 2005-04-07 08:07:34 EDT
Deferring post 3.1
Comment 11 Eclipse Webmaster CLA 2009-08-30 02:37:00 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.