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 249559 - Wrong indentation on new line with chained method call
Summary: Wrong indentation on new line with chained method call
Status: RESOLVED DUPLICATE of bug 251662
Alias: None
Product: javascript
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 8.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Petr Hejl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-29 14:10 UTC by Vladimir Riha
Modified: 2016-04-20 12:05 UTC (History)
0 users

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 Vladimir Riha 2014-12-29 14:10:48 UTC
Please try following in JS file 

var TripCtrl = {
    get: function (id) {
        return new Promise(function (resolve, reject) {
            if (id === null || typeof id === "undefined") {
                reject(new TPError(TPError.BadRequest, "Invalid trip ID"));
            } else {
                dbProvider.get(id)
                        .then();
            }
        });
    }
};




it is already formatted, but notice the indentation of ".then()", it should be 2 spaces to the right:


var TripCtrl = {
    get: function (id) {
        return new Promise(function (resolve, reject) {
            if (id === null || typeof id === "undefined") {
                reject(new TPError(TPError.BadRequest, "Invalid trip ID"));
            } else {
                dbProvider.get(id)
                          .then();
            }
        });
    }
};



Thank you

Product Version: NetBeans IDE Dev (Build 201412270001)
Java: 1.7.0_45; Java HotSpot(TM) 64-Bit Server VM 24.45-b08
Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18
System: Linux version 3.13.0-43-generic running on amd64; UTF-8; en_US (nb)
Comment 1 Petr Hejl 2016-04-20 09:34:19 UTC
I'm afraid I don't really understand? Why it should be 2 spaces right? It is continuation, so it has indentation of 8 spaces.
Comment 2 Vladimir Riha 2016-04-20 10:44:32 UTC
My point (maybe a wish then :) was that the ".then()" would be aligned with the end of "dbProvider." so that you would have the same indentation as the ".get()" on line above

The resulting formatting would be

dbProvider.get(id)
          .then();

which is (personally) better looking than

dbProvider.get(id)
   .then();
Comment 3 Vladimir Riha 2016-04-20 10:45:15 UTC
* than 

dbProvider.get(id)
        .then();
Comment 4 Petr Hejl 2016-04-20 12:05:59 UTC
I guess it is a duplicate of issue 251662.

*** This bug has been marked as a duplicate of bug 251662 ***