You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Christian Lenz (JIRA)" <ji...@apache.org> on 2018/11/09 13:58:00 UTC

[jira] [Created] (NETBEANS-1643) Formatting in JS files for nested objects is wrong

Christian Lenz created NETBEANS-1643:
----------------------------------------

             Summary: Formatting in JS files for nested objects is wrong
                 Key: NETBEANS-1643
                 URL: https://issues.apache.org/jira/browse/NETBEANS-1643
             Project: NetBeans
          Issue Type: Improvement
          Components: javascript - Editor, javascript - Formatting &amp; Indentation
    Affects Versions: 8.2, 10.0
            Reporter: Christian Lenz


When I have nested objects with objects and arrays it should indent like from the rules which is working, if you always create a new line inside of an object or inside of an array.

But if you opening an array and adding the opening curly bracket right after your array bracket "[{" w/o adding new line, it will break the formatting, for the next new line.

Right:
{code:javascript}
var test = {
    foo: [
        {
            bar: 2
        }
    ]
};
{code}

Wrong:
{code:javascript}
var test2 = {
    foo: [{
            bar: 3
        }],
    bar: [{a: {
                bar: 3
            }}]
};

var test3 = {
    foo: {test: {
            tt: 3
        }}
};
{code}

Of course the argument is, ok do it like the first one, but no, I want an object inside of an array starting right after the opening array because it looks nicer.

Expected formatting:
{code:javascript}
var test = {
    foo: [{
        bar: 3
    }],
    bar: [{
        a: {
            bar: 3
        }
    }]
};

var test3 = {
    foo: {
        test: {
            tt: 3
        }
    }
};
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists