We talked a few months ago about the new Script Editor we’re working on (The Script Editor). Well, now it’s starting to become real! With this release, the new architecture is live in Studio supporting several features. The full transition will be gradual and take place over the remainder of 2020. In addition to more visible improvements, you may start noticing the Script Editor get progressively faster, more responsive and less…quirky.
Folding and Formatting Improvements
As of today, code folding and auto formatting (including auto indentation and auto code block completion) are being driven by the new engine. Specific upgrades include:
- The script sidebar no longer displays fold indicators for code blocks that are not collapsible
- An extra line and indentations are automatically added when enter is pressed between a pair of curly braces for table syntax
- Auto code block completion is smarter about nested code blocks on the same line
- Auto indentation is smarter about aligning the closing line of a code block
Auto-Indent is Now the Default
The default settings for auto indentation have been changed to an “absolute” indentation rule. It corrects the indentation level to maintain proper formatting. For example, starting with this code and pressing Enter…
…will result in corrected formatting
If you don’t like this behavior, you may switch back to the old “relative” indentation rule in the Studio preferences.
Seeing Spaces (and Tabs)!
Viewing the examples above, you may ask yourself “Are those lines indented with tabs or spaces?”. And up until now you would just have to guess - but no longer! Now there is VISIBLE WHITESPACE. You can turn this goodness on with the Studio > Script Editor > Show Whitespace settings.
We will have more improvements here soon. For anyone dealing with some unholy mixture of spaces and tabs (shudder), selection formatting and whole document formatting are coming. Hang tough!
Moving Blocks (and Lines!)
We’ve added hotkeys to move blocks of code up and down. Alt+Arrow Keys (Opt+Arrow Keys on Mac) will do this now. Using these hotkeys without a selected block will move a single line up/down. Keep those hands on the keyboard!