Oo javascript code completion in any IDE

泪湿孤枕 提交于 2019-12-04 10:06:27

solution 1:

I found that in Eclipse the javascript indexer is a part of Web Tools Platform / Javascript Development Tools. The source code is here. The developers wrote that the InferEngine is easy extendable, so you can write an eclipse plugin. In that case this blog is really-really-really useful. It has great articles how to extend JSDT, and the JSDT developers can help too. Unfortunately I don't have much time to create such a thing if there is another solution.

solution 2:

Was looking around and found that the real problem is, that JSDOC 3 is not supported completely neither in Netbeans, nor in Eclipse JSDT and Aptana. The only IDE I found with JSDOC 3 support is Jetbrains WebStorm, so I'll use that. (Did not test the Resharper for Visual Studio, but it's JetBrains product either, so it possibly works too.)

The original example with jsdoc 3 in webstorm:

/** @class*/
var A = Function.create(//offer Function.[create] -> OK!
/** @lends A.prototype*/
{ 
    test: function (){
        console.log("a");
    },
    testA: function (){
        console.log("a2");
    }
});

/** @class*/
/** @extends A*/
var B = A.extend(//offer A.[extend] -> OK!
/** @lends B.prototype*/
{ 
    test: function (){
        console.log("b");
    },
    testB: function (){
        console.log("b2");
    }
});

/** @class*/
var F = Function.create(//offer Function.[create]  -> OK!
/** @lends F.prototype*/
{ 
    /** @returns A*/
    getA: function (){
        return new A();
    },
    /** @returns B*/
    getB: function (){
        return new B();
    }
});

var f = new F();
f.getA().test(); //offer f.[getA], offer f.getA().[test] -> OK
f.getA().testA(); //offer f.[getA], offer f.getA().[testA] -> OK
f.getB().test(); //offer f.[getB], offer f.getB().[test] -> OK
f.getB().testA(); //offer f.[getB], offer f.getB().[testA] -> OK
f.getB().testB(); //offer f.[getB], offer f.getB().[testB] -> OK

You can use something like WebStorm or VisualStudio with Resharper 6 installed and it builds a list of all prototypes of all objects and you can use that.. its not particularly useful nor would I recommend it.. But somethings better than nothing..

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