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.

Bug 6065 - [40cat] [indentation]If a line of code is broken over multiple lines in the source file, subsequent lines should be able to be indented
Summary: [40cat] [indentation]If a line of code is broken over multiple lines in the s...
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 3.x
Hardware: All All
: P3 normal with 7 votes (vote)
Assignee: issues@editor
URL:
Keywords:
: 7751 22210 48439 49450 49761 (view as bug list)
Depends on:
Blocks:
 
Reported: 2000-03-29 22:00 UTC by Jan Palka
Modified: 2007-11-05 13:39 UTC (History)
8 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Palka 2000-03-29 22:00:18 UTC
Compound Bracket on Next Line : True
If I have a long (>80 characters) line of code, I like to format it as follows.

javax.swing.JPanel =
  new java.swing.JPanel();

Splitting it over two lines in the source file for readability in a limited width of editor window.

However, when I use the "reformat" option from the pop-up menu in a Java editor, it reformats the code to:

javax.swing.JPanel =
new java.swing.JPanel();

I would like to see new properties added to the Java Editor to allow the following.
Indent Subsequent Split Lines :

default false to keep the same current default behaviour, I would set it to true to allow this behaviour.
Comment 1 Jan Lahoda 2001-01-24 15:37:59 UTC
Only changed version to Development.
Comment 2 Jan Chalupa 2001-03-12 10:36:24 UTC
Version: 'Dev' -> 3.2
Comment 3 David Konecny 2001-04-04 15:39:01 UTC
I'm moving this issue back to the Dev and changing the type to ENHANCEMENT. It 
will be implemented in next version.
Comment 4 Jan Chalupa 2001-05-05 21:55:07 UTC
Target milestone -> 3.3
Comment 5 David Konecny 2001-05-22 15:35:27 UTC
Re-assigning issues back to the bugs@editor.netbeans.org
Comment 6 David Konecny 2001-05-22 15:51:39 UTC
Changing the state of the issue to ASSIGNED, because it was cover in 
Requirements document at http://editor.netbeans.org/doc/Requirements.html
Comment 7 Jan Chalupa 2001-11-27 12:27:48 UTC
Target milestone -> 3.3.1.
Comment 8 Jan Lahoda 2002-06-03 14:07:10 UTC
*** Issue 22210 has been marked as a duplicate of this issue. ***
Comment 9 Marek Grummich 2002-07-22 09:50:51 UTC
Set target milestone to TBD
Comment 10 Marek Grummich 2002-07-22 09:56:35 UTC
Set target milestone to TBD
Comment 11 Jan Chalupa 2002-10-27 17:57:34 UTC
[S1S-EVAL]
Comment 12 bobtarling 2003-04-25 09:58:27 UTC
+1 for this feature
Rather than a true/false option could we have a seperate 
indent setting for wrapped lines.

I use the 4 space rule for normal indents and the 8 space 
rule for wrap lines as given by the Sun Coding Conventions 
http://java.sun.com/docs/codeconv/html/CodeConventions.doc3
.html#248
Comment 13 bondolo 2004-02-12 17:08:46 UTC
Given that the current behaviour violates:

http://java.sun.com/docs/codeconv/html/CodeConventions.doc3.html#248

Wouldn't this be a defect and NOT an enhancement? The priority
reasonably has to be higher than P5 (ignore forever) as well.

I have been using NetBeans for 3 years now and it is incredibly
frustrating that this issue hasn't been solved.
Comment 14 sreed 2004-02-16 18:30:14 UTC
I agree. This issue has been ignored for 3 years. It makes "reformat" 
useless to me. I add my vote for "defect" status, higher priority, 
and something more hopeful than "future" for the milestone.
Comment 15 psuk 2004-03-04 13:44:52 UTC
*** Issue 7751 has been marked as a duplicate of this issue. ***
Comment 16 Miloslav Metelka 2004-04-02 15:19:49 UTC
*** Issue 41567 has been marked as a duplicate of this issue. ***
Comment 17 Martin Roskanin 2004-09-06 12:32:31 UTC
*** Issue 48439 has been marked as a duplicate of this issue. ***
Comment 18 Martin Roskanin 2004-09-23 08:57:55 UTC
*** Issue 49450 has been marked as a duplicate of this issue. ***
Comment 19 cezariusz 2004-09-23 15:52:53 UTC
Is there anything else done besides collecting duplicates?
Comment 20 Dusan Balek 2004-10-01 08:33:27 UTC
*** Issue 49761 has been marked as a duplicate of this issue. ***
Comment 21 Miloslav Metelka 2004-10-06 15:28:57 UTC
NB4.0 solution:
Code reformatting: Subsequent lines of the reformatted statement will
be indented by a configurable amount of spaces (8 by default).
Indentation: After pressing of Enter the cursor will be shifted right
by the configured amount of spaces.

Post-NB4.0 solution:
Provide more advanced formatting rules - at least address the
conventions mentioned in 
http://java.sun.com/docs/codeconv/html/CodeConventions.doc3.html#248
Comment 22 crichey 2004-10-07 02:12:44 UTC
Sounds like an excellent solution
Comment 23 Miloslav Metelka 2004-10-15 15:45:01 UTC
I have implemented the proposed solution. The property "Statement
Continuation Indent" was added to the Java Indentation Engine and its
default value is 8. I would like to ask Patrick K. to add reference to
the docs regarding this. Thanks.
Together with the implementation I have written bunch of unit tests
that check the feature for both the indentation after pressing Enter
and for code reformatting.

For the following promotions the enhancement issue #20953 contains
detailed requests for multi-line indentation. I have added reference
to the code-conventions document to it as well.

Integrated in main trunk:
Checking in libsrc/org/netbeans/editor/ext/java/JavaFormatSupport.java;
/cvs/editor/libsrc/org/netbeans/editor/ext/java/JavaFormatSupport.java,v
 <--  JavaFormatSupport.java
new revision: 1.35; previous revision: 1.34
done
Checking in libsrc/org/netbeans/editor/ext/java/JavaSettingsDefaults.java;
/cvs/editor/libsrc/org/netbeans/editor/ext/java/JavaSettingsDefaults.java,v
 <--  JavaSettingsDefaults.java
new revision: 1.28; previous revision: 1.27
done
Checking in libsrc/org/netbeans/editor/ext/java/JavaSettingsNames.java;
/cvs/editor/libsrc/org/netbeans/editor/ext/java/JavaSettingsNames.java,v
 <--  JavaSettingsNames.java
new revision: 1.10; previous revision: 1.9
done
Processing log script arguments...
More commits to come...
Checking in src/org/netbeans/modules/editor/java/Bundle.properties;
/cvs/editor/src/org/netbeans/modules/editor/java/Bundle.properties,v 
<--  Bundle.properties
new revision: 1.78; previous revision: 1.77
done
Checking in src/org/netbeans/modules/editor/java/JavaIndentEngine.java;
/cvs/editor/src/org/netbeans/modules/editor/java/JavaIndentEngine.java,v
 <--  JavaIndentEngine.java
new revision: 1.9; previous revision: 1.8
done
Checking in
src/org/netbeans/modules/editor/java/JavaIndentEngineBeanInfo.java;
/cvs/editor/src/org/netbeans/modules/editor/java/JavaIndentEngineBeanInfo.java,v
 <--  JavaIndentEngineBeanInfo.java
new revision: 1.6; previous revision: 1.5
done
Processing log script arguments...
More commits to come...
Checking in
test/unit/src/org/netbeans/modules/editor/BaseDocumentUnitTestCase.java;
/cvs/editor/test/unit/src/org/netbeans/modules/editor/BaseDocumentUnitTestCase.java,v
 <--  BaseDocumentUnitTestCase.java
new revision: 1.5; previous revision: 1.4
done
Processing log script arguments...
More commits to come...
Checking in
test/unit/src/org/netbeans/modules/editor/java/JavaFormatterUnitTest.java;
/cvs/editor/test/unit/src/org/netbeans/modules/editor/java/JavaFormatterUnitTest.java,v
 <--  JavaFormatterUnitTest.java
new revision: 1.2; previous revision: 1.1
Comment 24 Roman Strobl 2004-12-23 15:30:33 UTC
Verified in build 200412221900.