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 224314 - Module pattern incorrectly indented.
Summary: Module pattern incorrectly indented.
Status: NEW
Alias: None
Product: javascript
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 7.2.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-30 11:38 UTC by Xypron
Modified: 2015-09-09 11:27 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xypron 2012-12-30 11:38:41 UTC
Dear maintainer,

a Javascript module may be written as:

( function(window) {
    var module;
    /* put more coding here */
    // Expose global
    window.module = module;
    }(window)
);

Reformatting creates

( function(window) {
    var module;
    /* put more coding here */
    // Expose global
    window.module = module;
}(window)
    );

The closing brace "}" should be indented, as it is inside of parentheses "()".

The closing parenthesis ")" on the last line should have the same indentation
as the corresponding opening parenthesis "(".

Bug 202932 - Support for Module pattern
describes a different problem related to the Navigator.

Best regards

Heinrich Schuchardt
Comment 1 Petr Hejl 2013-01-08 13:04:29 UTC
(In reply to comment #0)
> The closing brace "}" should be indented, as it is inside of parentheses "()".
Might be, but whole function block would be indented in such case. Others might don't like it in general case.

> 
> The closing parenthesis ")" on the last line should have the same indentation
> as the corresponding opening parenthesis "(".
Nope as it is continuation.

> 
> Bug 202932 - Support for Module pattern
> describes a different problem related to the Navigator.
> 
> Best regards
> 
> Heinrich Schuchardt

I think it is enhancement.