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 237643 - Formatter does not track parentheses correctly for line wrapping.
Summary: Formatter does not track parentheses correctly for line wrapping.
Status: REOPENED
Alias: None
Product: php
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 7.4
Hardware: Macintosh Mac OS X
: P4 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-25 05:25 UTC by pbw
Modified: 2013-10-25 14:34 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Source code indentiation screenshot (19.65 KB, image/png)
2013-10-25 08:31 UTC, mmolda
Details
Multiline Alignment>Method Call Arguments set off. (89.09 KB, image/png)
2013-10-25 14:32 UTC, pbw
Details
Multiline Alignment>Method Call Arguments set on. (87.00 KB, image/png)
2013-10-25 14:33 UTC, pbw
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pbw 2013-10-25 05:25:06 UTC
Product Version = NetBeans IDE 7.4 (Build 201310111528)
Operating System = Mac OS X version 10.8.5 running on x86_64
Java; VM; Vendor = 1.7.0_40
Runtime = Java HotSpot(TM) 64-Bit Server VM 24.0-b56

The following example may not present correctly. The second line, starting DB_PREF, is aligned to "insert into,
the third line, starting with the second instance of mysql_real_escape_string, is aligned to $moduleGroupName.

The problem seems to be that the formatter is not tracking nested parentheses, but simply looking back to the preceding
opening parenthesis.

$sql = sprintf( "insert into `%smodule_group` set `row_number` = %u, `translation`='%s',`name`='%s',`admin`='%u'",
                        DB_PREF, (int) $maxRowNumber, mysql_real_escape_string( $moduleGroupName ),
                                                                                                                       mysql_real_escape_string( $moduleGroupKey ),
                                                                                                                                                                   (int) $moduleGroupAdmin );
Comment 1 mmolda 2013-10-25 08:31:52 UTC
Created attachment 141545 [details]
Source code indentiation screenshot

Sorry it is working correctly in dev build for me.
Whe I use Format - everything is formatted in one line. If I have Line wraping on, it is working correctly. Finally, if I manually type in your code, and hit enter to continue on new line, indentiation is working correctly (see screenshot).

Please try it in latest dev build [1] and if it is still not working, add exact steps to reproduce and simply reopen.

Thank you.

[1] http://bits.netbeans.org/dev/nightly/

Product Version: NetBeans IDE Dev (Build 201310250001)
Java: 1.7.0_45; Java HotSpot(TM) Client VM 24.45-b08
Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18
System: Windows 7 version 6.1 running on x86; Cp1250; en_US (nb)
Comment 2 pbw 2013-10-25 11:14:00 UTC
Do I have to install the whole dev build, or can I add the php component into the existing 7.4 distribution?
Comment 3 pbw 2013-10-25 14:32:45 UTC
Created attachment 141558 [details]
Multiline Alignment>Method Call Arguments set off.

Multiline method call arguments off.
Comment 4 pbw 2013-10-25 14:33:34 UTC
Created attachment 141559 [details]
Multiline Alignment>Method Call Arguments set on.

Multiline Alignment>Method Call Arguments set on.
Comment 5 pbw 2013-10-25 14:34:53 UTC
Try it with Formatting> PHP> Alignment Multiline Alignment>Method Call Arguments set on.