Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-1643

Formatting in JS files for nested objects is wrong

    XMLWordPrintableJSON

Details

    Description

      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:

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

      Wrong:

      var test2 = {
          foo: [{
                  bar: 3
              }],
          bar: [{a: {
                      bar: 3
                  }}]
      };
      
      var test3 = {
          foo: {test: {
                  tt: 3
              }}
      };
      

      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:

      var test = {
          foo: [{
              bar: 3
          }],
          bar: [{
              a: {
                  bar: 3
              }
          }]
      };
      
      var test3 = {
          foo: {
              test: {
                  tt: 3
              }
          }
      };
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            chrizzly Christian Lenz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: