Uploaded image for project: 'Aptana Studio'
  1. Aptana Studio
  2. APSTUD-3792

JavaScript Code Formatter: More options for Spaces - Parentheses

    Details

    • Story Points:
      20

      Description

      The JavaScript Code Formatter is nice, but it's missing a few key options for me to use it.

      Specifically, there are only two options for Spaces - Parentheses (Before/After).

      However, parentheses are used for multiple reasons - if, function declarations, function calls, etc. My desired spacing for parentheses doesn't apply to all of these.

      For example, if I set Before = 1 and After = 0, I get:

      var a = function (b, c, d) { // BAD Don't want the space before function arguments here
          alert (b + c + d); // BAD Don't want the space before invokation arguments here
      }
      var c = a ? 10 : 20;
      var bb = {
          "a": 1,
          "b": 2,
          "c": 3
      };
      for (var i = 0, j = 0; i < 8 && j >= 0; i++, --j) { // GOOD This space is good
          alert ("(a " + a + ",j " + j + ")"); // BAD Don't want the space before invokation arguments here
      }
      if (xyz[1] >= 5) { // GOOD This space is good
      

      If I set Before = 0 and After = 0, I get

      var a = function(b, c, d) { // GOOD
          alert(b + c + d); // GOOD
      }
      var c = a ? 10 : 20;
      var bb = {
          "a": 1,
          "b": 2,
          "c": 3
      };
       
      for(var i = 0, j = 0; i < 8 && j >= 0; i++, --j) { // BAD I want a space here
          alert("(a " + a + ",j " + j + ")"); // GOOD
      }
      if(xyz[1] >= 5) { // BAD I want a space here
      

      If there were separate Parentheses rules for function arguments, function invocation, and for/if/etc clauses, it'd be much nicer.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sgibly Shalom Gibly
                Reporter:
                nicjansma Nic Jansma
              • Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Git Source Code