javascript - How do you attach JSdoc in Eclipse so that I can have autocomplete for a personal library - Stack Overflow

I have a JavaScript library that I am working on currently. I have structured it into lots of files and

I have a JavaScript library that I am working on currently. I have structured it into lots of files and I use the module approach to define each 'module'.

var ns = generateNamespace("me.mypany.mypackage.MyFile");

(function (ns, undefined) {
    // some module 
}(ns));

The modules are dynamically named using a namespacing function meaning that autoplete is almost impossible as things stand (unless Eclipse can run my code and figure out the namespaces, Visual Studio can!).

Therefore I intend to generate JSdoc for my project in the hope that if I include this into Eclipse (somehow) Eclipse can use this to give me content assist.

Firstly I do not know if this is possible... however I think that it is as I can see that it is maybe how this works? However I tried to follow this along and struggled to get something working, by this I mean it didn't work. The interesting info from the link:

"JSDT libraries are collections of JavaScript source files that have prototyped object/class definitions and JSDoc. The inference engine then models these libraries... making them available to every JavaScript file in the project... Bindings for nonstandard and future runtimes are similarly easy to create... add the... library to their project and gain content pletion and hover help"

I know how to write JSdoc annotations and I know how to generate JSdoc using one of the various tools.

What I need therefore is instructions on how to include JSdoc (as a library maybe) in Eclipse so that it will give auto plete for the stuff in the JSdoc.

I have a JavaScript library that I am working on currently. I have structured it into lots of files and I use the module approach to define each 'module'.

var ns = generateNamespace("me.mypany.mypackage.MyFile");

(function (ns, undefined) {
    // some module 
}(ns));

The modules are dynamically named using a namespacing function meaning that autoplete is almost impossible as things stand (unless Eclipse can run my code and figure out the namespaces, Visual Studio can!).

Therefore I intend to generate JSdoc for my project in the hope that if I include this into Eclipse (somehow) Eclipse can use this to give me content assist.

Firstly I do not know if this is possible... however I think that it is as I can see that it is maybe how this works? However I tried to follow this along and struggled to get something working, by this I mean it didn't work. The interesting info from the link:

"JSDT libraries are collections of JavaScript source files that have prototyped object/class definitions and JSDoc. The inference engine then models these libraries... making them available to every JavaScript file in the project... Bindings for nonstandard and future runtimes are similarly easy to create... add the... library to their project and gain content pletion and hover help"

I know how to write JSdoc annotations and I know how to generate JSdoc using one of the various tools.

What I need therefore is instructions on how to include JSdoc (as a library maybe) in Eclipse so that it will give auto plete for the stuff in the JSdoc.

Share Improve this question edited Feb 21, 2013 at 13:57 Neilos asked Feb 20, 2013 at 18:08 NeilosNeilos 2,7465 gold badges28 silver badges51 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 1

Previous answer:

You can also run jsdoc_toolkit from within eclipse by setting up Run -
> External Tools -> Open External Tools Dialog...

Location
C:\Program Files\Java\jre1.5.0_12\bin\java.exe

Working Directory
C:\DirectoryToWhereJsDocToolkitIsLocated\jsdoc_toolkit

Arguments
-jar app/js.jar app/run.js -r=4 -t=templates/htm "-d=C:
\PathToWhereDocIsSaved" "C:\PathToWebsiteToDocument"

For more about the arguments check the jsdoc_toolkit documentation.

Have fun
Simon

Taken from this Google Groups thread.

Updated Answer:

Eclipse JavaScript Editor: content assist for js files, autopletion

Disclaimer, I'm the author of tern.java.

I suggest you that you install tern.java. It provides a JSDoc support. Once you have selected this support, you can benefit

  • with pletion :

  • and soon with validation:

This support is not perfect but it starts working.

I am not using it by myself, so I'm not sure if it works, but there exists a grunt-plugin for jsdoc3. Grunt is supported by Eclipse. So maybe it helps.

Grunt-PlugIn in npm

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742285281a4415209.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信