Bug 108583 - [typing] Smart indentation on return indents to column after square brackets
Summary: [typing] Smart indentation on return indents to column after square brackets
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.1.1   Edit
Hardware: All All
: P3 minor (vote)
Target Milestone: 3.7 M6   Edit
Assignee: Rajesh CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-01 11:13 EDT by Markus Keller CLA
Modified: 2011-01-31 06:36 EST (History)
1 user (show)

See Also:


Attachments
Fix (847 bytes, patch)
2010-11-09 02:44 EST, Rajesh CLA
daniel_megert: review-
Details | Diff
Patch (3.20 KB, patch)
2010-11-30 03:07 EST, Rajesh CLA
daniel_megert: review-
Details | Diff
Patch (31.57 KB, patch)
2011-01-31 05:22 EST, Rajesh CLA
daniel_megert: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2005-09-01 11:13:11 EDT
M20050831-1200

Smart indentation on return always indents to column after square brakets:

public class Test {
	private void helper2(boolean[] booleans) {
		if (booleans[0]) {

		}
	}
}

With default Eclipse code formatter settings, set the caret to after one of the
"]" and press Enter.

Expected: the new line is indented by 2 more tabs than the line above
Was: new line is indented on column (with spaces)
Comment 1 Dani Megert CLA 2005-09-02 09:39:24 EDT

*** This bug has been marked as a duplicate of 65317 ***
Comment 2 Markus Keller CLA 2010-10-26 15:20:45 EDT
This is not fixed with the fix for bug 65317.
Comment 3 Rajesh CLA 2010-11-09 02:44:45 EST
Created attachment 182683 [details]
Fix
Comment 4 Dani Megert CLA 2010-11-16 02:40:03 EST
Comment on attachment 182683 [details]
Fix

The patch does not work for me: it still adds spaces instead of tabs. Also, please make sure that pressing 'Enter' before the ']' also works.
Comment 5 Dani Megert CLA 2010-11-16 09:23:32 EST
Forgot this: please also add a test case.
Comment 6 Rajesh CLA 2010-11-30 03:07:59 EST
Created attachment 184095 [details]
Patch

Handles continuation after ']' and '['. Also attached tests.
Comment 7 Dani Megert CLA 2010-12-01 08:35:05 EST
Comment on attachment 184095 [details]
Patch

This patch still does not work. Please read comment 4 again.
Comment 8 Dani Megert CLA 2010-12-01 09:10:31 EST
(In reply to comment #7)
> (From update of attachment 184095 [details] [diff])
> This patch still does not work. Please read comment 4 again.
One can argue that inserting spaces to align the closing square bracket is a feature, so lets leave that for now.

What's still not working is that Ctrl+I changes the indentation again.
Comment 9 Dani Megert CLA 2010-12-01 10:44:11 EST
> What's still not working is that Ctrl+I changes the indentation again.
That's a separate issue covered by bug 330556.

Committed the patch but with fixed indentation (the case statement was indented to far).
Available in builds >= N20101201-2000.
Comment 10 Dani Megert CLA 2010-12-03 03:03:04 EST
All recently made indent fixes had to be reverted due to several regressions (bug 331028, bug 330556 and bug 331734).
Comment 11 Dani Megert CLA 2011-01-28 09:26:11 EST
Committed Rajesh's modified patch (patch will be attached soon).
Comment 12 Rajesh CLA 2011-01-31 05:22:16 EST
Created attachment 187944 [details]
Patch