Search code examples
google-apps-scriptgoogle-apps-script-editor

Last brace → } are turning red instead of green, but the script works normally (Google App Script)


When I select the last brace of the script, it looks like this:

enter image description here

Logically, it has to appear green to confirm that everything is correct, such as this:

enter image description here

But the script runs to the end without error, is it normal to happen when the script is too large or has any errors in the script?

In other words, does the last brace necessarily have to turn green when selecting it?


Solution

  • This is one of a few bugs in the Apps Script code editor. Any code over approximately 100 lines will not display the matching outermost closing curly braces in green. Closing curly braces inside of the function block will show ending matching curly braces correctly as colored green. This bug seems to only affect the ending curly brace for the function block itself.

    Also, don't use periods in comments. It will cause the context menu to stop displaying.

    There is an issue reported on the Issue Tracker at:

    Issue Tracker - Apps Script - Terminating curly bracket