Google apps script editor's content assist is great, but buggy. Tips n' Tricks? Is this right forum for this?

梦想与她 提交于 2020-01-03 04:35:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!