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 225035 - Group Multiline Assignment split over multiple lines depends on location of operators
Summary: Group Multiline Assignment split over multiple lines depends on location of o...
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 7.3
Hardware: All All
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-17 16:20 UTC by berniev
Modified: 2013-02-26 14:55 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
pic of my settings (32.71 KB, image/png)
2013-01-21 12:03 UTC, berniev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description berniev 2013-01-17 16:20:40 UTC
Product Version = NetBeans IDE 7.3 Beta 2 (Build 201211062253)
Operating System = Linux version 3.0.0-30-generic-pae running on i386
Java; VM; Vendor = 1.6.0_24
Runtime = OpenJDK Client VM 20.0-b12

Another one to consider ...

<?php

// Sometimes it is prudent to break up long lines for readability
// Placing the operators at the end of each line formats ok, except maybe (?) one tab in too many
$a =
        $b == 1 &&
        $c == 2 &&
        $d == 3;

// placing the operators at the start of each line
// (which some say is the correct way)
// like this ...
$a =
    $b == 1
    && $c == 2
    && $d == 3;

// ... screws up: Puts it all back on one line resulting in this:
$a =
        $b == 1 && $c == 2 && $d == 3;
?>
Comment 1 Ondrej Brejla 2013-01-17 16:32:40 UTC
That "Group Multiline Assignment" feature is a whole crap and should never be implemented. Grrr :) It just makes problems...

I'll try to look at it later. Thanks.
Comment 2 berniev 2013-01-17 16:46:29 UTC
Good luck with that. It's quite a neat idea if done right.
Comment 3 Ondrej Brejla 2013-01-21 10:43:32 UTC
It seems to be a buggy behavior of that first case (&& at the end of line), because wraping of binary operators is handled by Tools->Options->Editor->Formatting->PHP->Wrapping->Binary Operators. And if NEVER is set, then it should be reformatted to one line.

It shouldn't be connected to Group Multiline Assignment option. Have to evaluate it more deeply.

Product Version: NetBeans IDE Dev (Build 20130121-a14f31ffb7ce)
Java: 1.6.0_26; Java HotSpot(TM) Client VM 20.1-b02
Runtime: Java(TM) SE Runtime Environment 1.6.0_26-b03
System: Linux version 3.5.0-21-generic running on i386; UTF-8; cs_CZ (nb)
Comment 4 berniev 2013-01-21 12:03:18 UTC
Created attachment 130440 [details]
pic of my settings

FYI my settings
Comment 5 berniev 2013-02-26 14:55:08 UTC
I take your point.

But once the first case is fixed per your note the question then becomes:

"how, for readability, can a statement be split over multiple lines?".

In the example it is the logical operators we want to wrap on.

Split the concept of "binary operators" into "logical" and "other"?

Personally I don't see a use case for wrapping on binary operators as currently implemented, as for mine it makes a mess, but I guess others do?