Using Content Assist in Google Apps Script

I always have difficulty remembering the exact syntax of some programming constructs, such as the order of parameters in a function call, or the exact name of a method.

I’ve often abandoned the blinking cursor within the Code Editor to go and look for reference material, either online or printed.

Luckily, Google’s Code Editor has something called Content assist to come to the rescue. You can open it via the Edit menu (or press the space bar while holding down the Ctrl key):

Click image to enlarge

Click image to enlarge

Content assist will pop open a scrollable window displaying all the Apps Script objects or methods that you could feasibly use. It’s sensitive to the context of what you’ve already typed, so you’ll only see items in the list that are relevant; in the image below, I’m at the start of a line within a new (i.e. currently empty) function, so Content assist is showing me a list of Apps Script objects that I might want to employ: 

Click image to enlarge

Click image to enlarge

You’ll see that some of the items are crossed out (struck through) – taking a look at the Google documentation for one such object gives a clue as to why: 

Click image to enlarge

Click image to enlarge

Click on an object to copy its name into your code. Entering a period (.) after the object name will fire up Content assist once more, this time to offer you all of the methods and properties that you might conceivably use next: 

Click image to enlarge

Click image to enlarge

Of course, this list can be really long. To reduce it to manageable proportions, type the first letter(s) of the property or method you want, and the list will respond in real time:

Click image to enlarge

Click image to enlarge

Pressing the Escape key will hide the pop-up window and leave you back in the edit session.