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 23508

Summary: Indentation of x ? y : z
Product: editor Reporter: ats37 <ats37>
Component: Formatting & IndentationAssignee: issues@editor <issues>
Severity: blocker    
Priority: P3    
Version: 3.x   
Hardware: PC   
OS: Windows 3.1/NT   
Issue Type: DEFECT Exception Reporter:

Description ats37 2002-05-15 11:54:17 UTC
I have some expressions using the ternary conditional 
operator x ? y : z  If the expression is all on one line, 
the indentation formatter leaves it alone (as expected).  
However if, because of the expression lengths, I have to 
split it over multiple lines e.g.
something = (someComplicatedExpression != null) ?
        (aComplexCalculation) :
the indenter makes a real mess of reformatting it, moving 
the second line back to the same level as "something" and  
indenting everything following it in the code block by an 
extra tab space.  I guess this could be because it thinks 
the second line is a case label?
Comment 1 Miloslav Metelka 2002-05-17 09:51:54 UTC
Yes, the problem is that the indentation engine treats it as the case
label. Although the long term solution will be to base the indentation
engine on an incremental parser we need to find short term solution
for this problem.
Comment 2 Marek Grummich 2002-07-22 09:47:48 UTC
Set target milestone to TBD
Comment 3 Marek Grummich 2002-07-22 09:51:09 UTC
Set target milestone to TBD
Comment 4 Martin Roskanin 2003-03-10 10:28:17 UTC
*** Issue 30346 has been marked as a duplicate of this issue. ***
Comment 5 Martin Roskanin 2003-08-08 14:09:41 UTC
*** Issue 35337 has been marked as a duplicate of this issue. ***
Comment 6 _ gtzabari 2003-12-30 02:32:57 UTC
Any progress on this issue? Indentation is also incorrect for 'assert'.
Comment 7 Martin Roskanin 2004-08-20 16:33:30 UTC
*** Issue 41567 has been marked as a duplicate of this issue. ***
Comment 8 Dusan Balek 2004-08-30 08:35:06 UTC
Fixed in [maintrunk].

Checking in;
new revision: 1.31; previous revision: 1.30
Comment 9 Roman Strobl 2004-12-23 15:51:47 UTC
Verified in build 200412221900.