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

2

5

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.

Whalebone answered 4/12, 2012 at 20:24 Comment(2)
I don't see what you describe... even after 300 lines of code. Are you sure you don't have something else in your code that causes this ?Achromat
I created a new spreadsheet and entered lots of blank lines between the start and end of the default function. I am using chrome on a mac osx 10.5.2Whalebone
N
9

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?

Natural answered 5/12, 2012 at 3:43 Comment(0)
A
2

It doesn't effect the code being run, see issue 2237 in the issue tracker :

Terminating curly bracket in function definition won't turn green

Arri answered 13/4, 2016 at 21:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.