Uploaded image for project: 'Appcelerator Studio'
  1. Appcelerator Studio
  2. TISTUD-1661

JavaScript Formatter: Spaces preferences contains edge case improvements

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Low
    • Resolution: Won't Fix
    • Affects Version/s: Titanium Studio 2.0.2
    • Fix Version/s: None
    • Component/s: Configuration, JS
    • Environment:

      Studio: 2.0.2.201205141508
      OS: Snow Leopard

    • Story Points:
      0

      Description

      Titanium Studio > Preferences > Titanium Studio > Formatter > JavaScript contains edge cases where the formatting fails.

      The sample code is below, all spacing is set to 5.

      /*
      * Punctuation Elements: End Statement Semicolons
      *
      * */
       
      //
      // no spaces before or after end statements
      //
       
      var x     = function     (     ) {
      };
       
      var x;
       
      var x     =     new Array     (     );
       
      /*
      * Operators: Switch Scope Operator
      *
      * */
       
      //
      // no spaces before or after : operator in switch case statement
      //
       
      switch(x) {
      	case 'x':
      		break;
      	case z:
      		break;
      	case (z):
      		break;
      	case (x < y):
      		break;
      	default:
      		break;
      }
       
      /*
      * Keywords
      *
      * */
       
      //
      // no spaces before variable name declarations
      //
       
      function foo     (     ) {
      };
       
      var i     =     x;
      void s;
       
      //
      // no spaces before type instantiations
      //
       
      c     =     new Array     (     a     ,     b     ,     c     );
       
      //
      // no spaces after return keyword before implicit groupings
      //
       
      switch (x) {
      	default :
      		return xyz     [     0     ]     >     2     ?     10     :     20;
      }
       
      return x;
       
      return function     (     ) {
      };
       
      return {};
       
      //
      // no spaces between else and if
      //
       
      if     (     x     ) {
      } else if     (     z     ) {
      }
       
      //
      // no spaces after case
      //
       
      switch(x) {
      	case x:
      		break;
      }
      
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kkolipaka Kondal Kolipaka (Inactive)
                Reporter:
                dhyde Dustin Hyde
              • Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: