最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to make JavaScript function visible in Eclipse "Outline View"? - Stack Overflow

programmeradmin0浏览0评论

I have such code but can not turn on outline of function if it defined in anonymous function - there is not problem with class.

How can I outline something2 - please share some hints?

I can mark all function as constructors but it is invalid approach.

// --- start of track event ---
// required debug.js
(function (window) {

/**
 * @memberof erest.track_event
 */ 
function something2() {
}

/**
 * @memberof erest.track_event
 * @constructor
 */
function something3() {
}
}(window));
//--- end of track event ---

function something1() {
}

I was tested all filtering options, jsdoc and study Eclipse preferences but has no idea what to do to make something2 visible in outline view?

I have such code but can not turn on outline of function if it defined in anonymous function - there is not problem with class.

How can I outline something2 - please share some hints?

I can mark all function as constructors but it is invalid approach.

// --- start of track event ---
// required debug.js
(function (window) {

/**
 * @memberof erest.track_event
 */ 
function something2() {
}

/**
 * @memberof erest.track_event
 * @constructor
 */
function something3() {
}
}(window));
//--- end of track event ---

function something1() {
}

I was tested all filtering options, jsdoc and study Eclipse preferences but has no idea what to do to make something2 visible in outline view?

Share Improve this question edited May 25, 2015 at 14:36 Joshua Taylor 86k9 gold badges162 silver badges364 bronze badges asked May 8, 2014 at 14:13 ChameleonChameleon 10.2k18 gold badges72 silver badges134 bronze badges 2
  • I am running Eclipse Luna (latest available) and am still suffering this puzzle. – Kolban Commented Nov 25, 2014 at 0:13
  • Note that only the first level is shown in the outline (by design), so it won't work if you have your JS code wrapped in a self-executing anonymous function. – thdoan Commented Nov 27, 2018 at 22:43
Add a ment  | 

1 Answer 1

Reset to default 4 +50

You have a small typo in the @memberOf annotation. Change to a capital O and it should work just fine:

(function(window) {

  /**
   * @memberOf erest.track_event
   */
   function something2() {
   }

  /**
   * @memberOf erest.track_event
   * @constructor
   */
   function something3() {
   }

}(window));

function something1() {
}

Remove the @constructor annotation, if appropriate, to get something3() in the outline and not the constructor function.

Here is a similar question asked. Follow the link in the answer to get some more information.

发布评论

评论列表(0)

  1. 暂无评论