Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autocomplete for my functions in the google-apps-script editor

Can I get in editor autocomplete for my functions using JSDoc somehow?

I am creating a big google spreadsheet with a lot of code in the associated script editor.

I get autocompletion help when I write the period on LINE 1 (see code below), but not when writing the period on LINE 2. Is it possible to use JSDoc syntax to get autocomplete help when writing the period on LINE 2 also?

I have not succeeded getting this to work for normal javascript objects nor Spreadsheet related objects. I'm interested in both.

/** Failed attempt on getting autocomplete help using JSDoc on a google Range object
* @returns {Range}
*/
function getMyRange() {
  return SpreadsheetApp.getActiveSpreadsheet().getRangeByName('myRange');
};

/** Failed attempt on getting autocomplete help using JSDoc on standard JS-object
* @returns {Array}
*/
function getMyArray() {
  return SpreadsheetApp.getActiveSpreadsheet().getRangeByName('myRange');
};

function test() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();

  // Please think of the code below as 4 separate examples, nothing
  // of the below is meant to compile as it is. It is just 4 separate
  // demonstrations of when I'd like to get autocompletion help and notes
  // on when I do and don't
  ss.getRangeByName('myRange'). // **** LINE 1 **** I get autocomplete
  getMyRange().                 // **** LINE 2 **** No autocomplete

  [].                           // **** LINE 3 **** I get autocomplete
  getMyArray().                 // **** LINE 4 **** No autocomplete...
};
like image 300
consideRatio Avatar asked Jan 11 '15 02:01

consideRatio


1 Answers

Auto complete using JSDoc for non GAS functions works for code added as a Library not inline to the same script. It is a limited IDE in that respect.

https://developers.google.com/apps-script/guide_libraries#guidelines

like image 113
JSDBroughton Avatar answered Sep 19 '22 13:09

JSDBroughton