Bug 45014 - Formatter misplaces semicolon
Summary: Formatter misplaces semicolon
Status: VERIFIED FIXED
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: 3.0 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-16 10:12 EDT by Stefan Matthias Aust CLA
Modified: 2003-11-19 12:11 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Matthias Aust CLA 2003-10-16 10:12:01 EDT
You you format this with the new 3.0M4 formatter you might notice that the ";"
after "0.5)" is misplaced by two tabs.  If the code is more deeply nested - for
example in an anonymous Action subclass, tree or more tabs are inserted.

public class A {

	public void actionPerformed(ActionEvent e) {
		getParentTiledContainer()
				.dockPaneAt(Integer.parseInt(e.getActionCommand()), pane,
RTabbedDocumentPane.this,
						0.5)		;
	}
}
Comment 1 Olivier Thomann CLA 2003-10-16 11:05:43 EDT
I will investigate.
Comment 2 Olivier Thomann CLA 2003-10-16 11:45:50 EDT
Nice find.
It only happens if you have an implicit this in front of the first method
invocation.
So it would not happen if you write:
this.getParentTiledContainer()
instead of:
getParentTiledContainer()

I am investigating a fix.

Comment 3 Olivier Thomann CLA 2003-10-16 12:11:29 EDT
Fixed and released in HEAD.
Regression tests added.
In fact the alignment strategy will be reviewed when we have more feedbacks. We
are not quite happy with some formatting in case of multiple nested alignments.
Even if this is revisited in the future, this should not change.
Now we have:
public class A {
	public void actionPerformed(ActionEvent e) {
		getParentTiledContainer()
				.dockPaneAt(Integer.parseInt(e.getActionCommand()), pane,
						RTabbedDocumentPane.this, 0.5);
	}
}

Of course it doesn't look good thanks to Bugzilla :-(.
Comment 4 Stefan Matthias Aust CLA 2003-10-16 14:23:32 EDT
Thanks for fixing this so fast!

Regarding the indentation/alignment strategy: I dislike that the formatter tries
to put as many argument as possible on that line.  I'd prefer this simple
strategy: If everything fits into a single line then put it into a single line
otherwise put each argument into a separate line.
Comment 5 Olivier Thomann CLA 2003-10-16 14:37:52 EDT
This will be customizable when the code formatter preference page is ready. By 
default, we chose the Sun conventions for long arguments.
Comment 6 David Audel CLA 2003-11-19 12:11:53 EST
Verified.