[英]How do you attach JSdoc in Eclipse so that I can have autocomplete for a personal library
I have a JavaScript library that I am working on currently. 我目前正在处理一个JavaScript库。 I have structured it into lots of files and I use the module approach to define each 'module'.
我已将其构建为大量文件,并使用模块方法来定义每个“模块”。
var ns = generateNamespace("me.mycompany.mypackage.MyFile");
(function (ns, undefined) {
// some module
}(ns));
The modules are dynamically named using a namespacing function meaning that autocomplete is almost impossible as things stand (unless Eclipse can run my code and figure out the namespaces, Visual Studio can!). 这些模块是使用命名空间函数动态命名的,这意味着自动完成几乎是不可能的(除非Eclipse可以运行我的代码并找出命名空间,Visual Studio可以!)。
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. 因此,我打算为我的项目生成JSdoc,希望如果我将它包含在Eclipse中(不知何故),Eclipse可以使用它来为我提供内容帮助。
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 completion and hover help"
“JSDT库是具有原型对象/类定义和JSDoc的JavaScript源文件的集合。推理引擎然后对这些库进行建模......使它们可用于项目中的每个JavaScript文件...非标准和未来运行时的绑定类似易于创建...将...库添加到他们的项目并获得内容完成和悬停帮助“
I know how to write JSdoc annotations and I know how to generate JSdoc using one of the various tools. 我知道如何编写JSdoc注释,我知道如何使用各种工具之一生成JSdoc。
What I need therefore is instructions on how to include JSdoc (as a library maybe) in Eclipse so that it will give auto complete for the stuff in the JSdoc. 因此,我需要的是有关如何在Eclipse中包含JSdoc(作为库)的说明,以便它可以自动完成JSdoc中的内容。
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. 取自此 Google网上论坛主题。
Updated Answer: 更新答案:
Eclipse JavaScript Editor: content assist for js files, autocompletion Eclipse JavaScript Editor:js文件的内容辅助,自动完成
Disclaimer, I'm the author of tern.java . 免责声明,我是tern.java的作者。
I suggest you that you install tern.java . 我建议你安装tern.java 。 It provides a JSDoc support .
它提供了JSDoc支持 。 Once you have selected this support, you can benefit
一旦选择了这种支持,您就可以从中受益
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. 我不是自己使用它,所以我不确定它是否有效,但是jsdoc3存在一个grunt-plugin。 Grunt is supported by Eclipse.
Eclipse支持Grunt。 So maybe it helps.
所以也许有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.