1

Edit: Fixed!

The Google Apps Script team rolled this out for our team earlier this week (week of January 10th).

Original Post

I'm a frequent GAS user, and I've noticed that, since the upgrade to the V8 runtime, formatting in the GAS IDE is awful. I've seen a somewhat similar question here, but my problem is that the GAS IDE is terrible at formatting ES6 Javascript.

Expected Behavior

  • variables defined with const or let appear similarly to variables defined with var
  • the omission of a semicolon will not completely break the indention / formatting of a script
  • destructured variables will be recognized as variables by the IDE
  • template literals will be recognized by the IDE

Current Behavior

The IDE basically doesn't recognize any of my JavaScript ES6 syntax. Here's an example:

/** Comments about some function.
* @dev Why does this look like garbage!?
*/
          function foo() {
          ...
         }       

In the above example, it's impossible to get the IDE to properly indent the function. Instead, each line of code is indented to the same extent by default.

Has anyone figured out how to use ES6 syntax, omit semicolons, etc. and gotten the browser-based GAS IDE to format properly?

Thanks!

Davis Jones
  • 1,504
  • 3
  • 17
  • 25
  • 1
    It seems okay to me in the new editor – Cooper Jan 10 '21 at 18:36
  • 3
    The old editor also doesn't do very well with arrow notation. But my guess is that they have enough to with the new editor for now. I guess some do not have it as yet but I believe it's coming at the end of January. – Cooper Jan 10 '21 at 18:38

2 Answers2

1

You might try to use a web browser extension that allow you to set custom CSS styles but the effort required might not be worthy because the new Google Apps Script is being rolled out.

According to the last announcement update the rollout should finish during January 2021

Reference

Related

Rubén
  • 34,714
  • 9
  • 70
  • 166
0

Workaround

If there are any missing features or behaviours that you don't like on the Apps Script IDE you can:

  • Update to the newer version of the IDE with more features described here
  • Use clasp which allows you to develop and manage Apps Script projects from your terminal rather than the Apps Script editor therefore being able to use the IDE of your choice with the features you like.
  • If there is a specific missing feature you would like the Apps Script editor to have you can report a feature request
Mateo Randwolf
  • 2,823
  • 1
  • 6
  • 17