Search code examples
javascripteclipsedocumentationprototypejsjsdoc

JSDoc auto-complete documentation in Eclipse is not working for Class.create()


I have something like:

/**
* @class
*/
NS.MyAwesomeObject = Class.create();

NS.MyAwesomeObject.prototype = {
 /**
 * @param id - the id
 * @return - an alert dialog with an id
 */
 initialize : function(id){
    alert(id);
 }
}

Am I missing something? I get up to NS. -> auto-complete: MyAwesomeObject, but I want NS.MyAwesomeObject. -> auto-complete: initialize(id).

It works fine for other cases when I don't use Class.create(). I googled and the solution was to add @class, but that didn't work for me.

Thanks!


Solution

  • It works by me. Btw Eclipse doesn't have jsDoc 3 support. With jsDoc 3 your code looks so:

    var NS = {};
    
    /** @class */
    NS.MyAwesomeObject = Class.create(
        /** @lends NS.MyAwesomeObject.prototype */
        {
            /**
             * @constructs
             * @param {Number} id - the id
             * @returns {Void} - an alert dialog with an id
             */
            initialize:function (id) {
                alert(id);
            }
        });
    

    The code completion for jsDoc 3 works only with WebStorm (or others Jetbrains products) now.

    Oo javascript code completion in any IDE (Had problem with this either.)