问题
Is this right place for google script editor questions? Hope so.
Content assist is great, but stops working at times for me. Sometimes fix is to cut/paste all my code in/out of a desktop text editor, and back into google script editor. Perhaps this cleans out hidden chars, tags, etc., or perhaps it resets content assist. Dunno. But, works somewhat. Any thoughts? Tips? Trick?
Too, here's great crash course on google script editor from the developers. Well worth a the watch: Crash Course Apps Scrip Editor
If not appropriate place for editor questions, please point me to it. Thanks.
Also, does GAS stand for google apps script? google apps services? A library? Wha? Yes, I'm kinda newbie. Is there an apps script related wiki?
回答1:
One trick to reset the content assist is to go back up to the class and retype a period right after it. So, if you're working with a line of code that involves Sheets and it has lost auto-complete for what ever reason, typing the period right after the firstSpreadsheetApp
in the function has worked for me.
SO is the wiki. Please don't use a "GAS" for abbreviation.
回答2:
This seems to work for me when I lose CONTENT ASSIST [object method prompting] ... for the moment ... the getfid function may somehow be used by the editor when following the actual 2 steps in the function beneath it.
function getfid(fname) {
files = DriveApp.getFilesByName(fname);
file = files.next();
fid = file.getId();
return fid;
}
// the following 2 steps seem to turn CONTENT ASSIST back on ???
// 1. type the period after the SpreadsheetApp [ss must exist?]
// 2. then test to see if TA is back on by typing the period after ss_ad
function resetCONTENTASSIST() {
ss_ad = SpreadsheetApp.openById(getfid('adminDATA'));
ss_ad.
}
回答3:
I tried re-typing the period after SpreadsheetApp and it didn't seem work for me. I was chaining variables together like this:
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet(),
open_log = spreadsheet.getSheetByName('OPEN_LOG'),
closed_log = spreadsheet.getSheetByName('CLOSED_LOG'),
invoiced_log = spreadsheet.getSheetByName('INVOICED_LOG');
Once I changed the code to:
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var open_log = spreadsheet.getSheetByName('OPEN_LOG');
var closed_log = spreadsheet.getSheetByName('CLOSED_LOG');
var invoiced_log = spreadsheet.getSheetByName('INVOICED_LOG');
the content assist started working again. I'm not 100% positive this is the fix, just seemed to work for me this time. Give it a try...beats pulling your hair out.
来源:https://stackoverflow.com/questions/22482519/google-apps-script-editors-content-assist-is-great-but-buggy-tips-n-tricks