Why does google script editor stop paren matching after 100 lines in a function and does it affect the code?

I’ve tried this myself, and reproduced your results, using Chrome on Windows Vista. The paren matching went Red with exactly 100 blank lines between the opening and closing braces.

Steps to try, for the non-believers:

  1. In Drive / Docs, create a new script for a blank project.
  2. Start with the template for “myFunction()”. Place the cursor next to the opening or closing brace, and observe that the brace matches green.
  3. Now enter blank lines in the function body until the closing brace is on line 101.
  4. Place the cursor next to the brace, and observe that it’s red.
  5. Delete one line, and check again… now it’s green.

So, CONFIRMED, paren matching stopped, and not because the code was malformed. Why? Well, my guess would be that some limit was necessary, and 100 was a nice, round number.

Edit: Paren aka parentheses, brackets, or braces.

Does it affect your code? Nope – during the save operation, the code parses correctly. (If it didn’t, you’d get some error that might or might not help figure out your mistake.)

But why not take that 100-line limit as a hint, and refactor your code?

Leave a Comment