Aptana Studio
  1. Aptana Studio
  2. APSTUD-3214

JavaScript: Formatting destroys incrementation operator

    Details

      Description

      The autoformat-function dosn't recognize in-/de-cremention.

      function foo() {
        i++>1;
      }
      

      formats to:

      function foo() {
      	i + +>1;
      }
      

      Note, putting a space between the + and > results in:

      function foo() {i++ > 1;
      }
      

      Which is not ideal.

      Workarounds:

      • Set the option in Preferences/Aptana Studio/Formatter/JavaScript/>edit profile</Spaces/Operators/Arithmetic Operators/[Before: & After:] to 0.
      • Add a space between the + and >

        Activity

        Hide
        Ingo Muschenetz added a comment -

        I can't reproduce this.

        I tried:

        1. Open new JavaScript document
        2. Paste in the following code:
          function foo() {
              i++>1
          }
          
        3. Attempt to format the document. Also, adjust the pre-post spacing as suggested in the ticket. No difference--everything works as expected.

        Please paste in an example we can replicate and we will be happy to take a look.

        Show
        Ingo Muschenetz added a comment - I can't reproduce this. I tried: Open new JavaScript document Paste in the following code: function foo() { i++>1 } Attempt to format the document. Also, adjust the pre-post spacing as suggested in the ticket. No difference--everything works as expected. Please paste in an example we can replicate and we will be happy to take a look.
        Hide
        Steven John Lange added a comment - - edited

        Please try this:

        function foo() {
          i++>1; // becomes: i + +>1;
        }
        

        or this:

        function foo() {
          if(i--==y) // becomes: if(i - -==y)
            alert('test');
        }
        

        I think the effect also occurs in some other combinations.

        Show
        Steven John Lange added a comment - - edited Please try this: function foo() { i++>1; // becomes: i + +>1; } or this: function foo() { if(i--==y) // becomes: if(i - -==y) alert('test'); } I think the effect also occurs in some other combinations.
        Hide
        Ingo Muschenetz added a comment -

        I was able to reproduce in the situation you described. Thanks!

        Show
        Ingo Muschenetz added a comment - I was able to reproduce in the situation you described. Thanks!
        Hide
        Kevin Lindsey added a comment -

        This was an issue in how we recognize operators. I've updated the word detector so we won't recognize operators that don't actually exist in our list. Specifically, we were matching "+>" instead of "+" and ">" separately.

        Show
        Kevin Lindsey added a comment - This was an issue in how we recognize operators. I've updated the word detector so we won't recognize operators that don't actually exist in our list. Specifically, we were matching "+ >" instead of " +" and ">" separately.

          People

          • Assignee:
            Kevin Lindsey
            Reporter:
            Steven John Lange
          • Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: