Affects Version/s: Release 3.2.3
Fix Version/s: Release 3.4.0
Appcelerator Studio 126.96.36.199404181520-18042014152112
SDK 3.2.2.GA | 3.2.3.GA
Sprint:2014 Sprint 12 Studio
I have noticed that the formatter used within the Studio application has a number of issues that are causing me and my team a lot of difficulties when working with different tools and attempting to maintain a high level of code quality.
1. Studio reformats functions and var declarations within functions incorrectly. I say incorrect as it can cause JSHint errors afterwards also existing formatting applied, say by developer A, gets reformatted by Studio when developer B edits the documents.
If this is copy/pasted into Studio, and you use the Source Format option, by default or with custom settings, a few things happen that break the styling and flow.
The "use strict"; statement is placed immediately to the right of the opening brace, the variables are all moved onto a single line, and switch statements re-indent themselves.
This is very frustrating when you are working on multiple branches of a project and the commits are going back and forth due to formatting changes made by the product. Take a look at what Studio does to the code example:
The case should be indented with the switch, the vars should stay on a newline and the "use strict"; should not move.
This raises a wider question as why we can't use JSBeautifer rules/tags for certain settings. The formatting options and rules probably would better serve us if they adopted more of this standard approach that is more widely adopted. (just an idea).
My main issue is this current reformatting.
Key Issues that need to be addressed:
- "use strict"; should not reflow immediately after the brace
- var declarations on newlines should not all be placed on a single line
- switch statements should not indent cases.