Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

in google script editor

function foo(){ . . . // more than 100 lines . . }

clicking on { or } highlights both in red

with less than 100 lines both are green.

Does it affect the code or is it just there to confuse us.

like image 999
MalcL Avatar asked Dec 04 '12 20:12

MalcL


People also ask

What is === in Google script?

Equality (==): a == b results in true if the value a is equal to value b. Strict equality (===): a === b results in true if the value a is equal to value b and their types are also the same. Inequality (! =): a !=

How long can a Google script run for?

Google Ads scripts for advertiser accounts can execute for a maximum of 30 minutes, after which they will be cancelled. All of the changes made before the script was cancelled will be applied.

Why is Google script not working?

There are a few possible causes for these errors: A Google server or system is temporarily unavailable. Wait for a few moments and try running the script again. There is an error in your script that doesn't have a corresponding error message.


1 Answers

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?

like image 71
Mogsdad Avatar answered Nov 05 '22 19:11

Mogsdad