This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
When you press Enter to go to new line after typing an opening brace, caret is indented as you need, but then, after you type a brace, the indent is removed. If you go to Tools>Options>Editor>Formatting and if you choose "Java" for Language, "Braces" from the cathegory combo and then "Braces Placement", you can set "New Line Indented" for "Other". However, this setting is not correctly respected when you type the code manually. Example - editor should allow: if(a == 1) [single tab here]{ [single tab here]<some code...> [single tab here]} So, after typing the 'if' line and hitting return, editor auto-indents by a single tab but then upon hitting the '{' it immediately removes the tab, so the brace is aligned under the 'i' of 'if'. THIS WAS REPORTED 20 MONTHS AGO AND IS STILL NOT FIXED!!
(In reply to comment #0) > THIS WAS REPORTED 20 MONTHS AGO AND IS STILL NOT FIXED!! So, where is the original report? Hove you got its number? Thanks
http://netbeans.org/bugzilla/show_bug.cgi?id=150228 which was marked as duplicate of http://netbeans.org/bugzilla/show_bug.cgi?id=147612 This is not resolved after 20 months. When you type the following (for example) or any other statement requiring {}: while(a == 1) and hit return, the editor autoindents as it should: while(a == 1) [indent here]<-- cursor is now here then you hit opening brace { and the editor moves the brace and cursor back to underneath the while, like this: while(a == 1) { This is really frustrating and is not how I write code. It is also ignoring the settings in the Editor prefs. If you know a way round this I would be most grateful to hear it! Thanks, Alex
Well, I understand that this is frustrating and we are sorry about not being able to fix this for so long. The problem is that the java editor uses the advanced formatter only for formatting (eg. all the formatting settings from Tools-Options are applied only when formatting), but not for indenting. When indenting the editor still uses the old simple indenter. This is a long time overdue task to rewrite the java editor indentation and use the new settings. Unfortunately, it's not an easy task and the focus in the recent releases has been elsewhere.
*** Bug 147612 has been marked as a duplicate of this bug. ***
Fixed in jet-main. http://hg.netbeans.org/jet-main/rev/571021c3261d
Integrated into 'main-golden', will be available in build *201005170932* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/ User: Log:
Integrated into 'main-golden', will be available in build *201005182201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/ User: Log: