WebStorm: How to generate JSDoc documentation - javascript

I just started using WebStorm and JSDoc to document my JavaScript. Still I have not found a way to generate a HTML documentation using some kind of WebStorm built-in functionality. I searched the web and Stack Overflow, but only found a lot of questions about the syntax of JSDoc, etc.
What am I missing? I am using WebStorm 7.0.3.

Since Webstorm v8.0.0, you can create JSDoc comments by simply typing /** right before the method or function declaration you want to add the documentation, and then press Enter, this will generate a basic block with all your parameters already set.
More info on this Webstorm article.

Nice article about jsDoc for phpStorm at this link.
In WebStorm I guess the same.

WebStorm has no built-in functionality to generate documentation. You can use external solutions for that, at least as https://github.com/jsdoc3/jsdoc
I use jsduck for that: https://github.com/senchalabs/jsduck

WebStorm has a built-in function to help a little when creating JSDoc documentation in your code, they explain it in this article. As far as I could look for, there's no plugin on the WebStorm plugin store to further help us creating nor rendering JSDoc documentation. For that, you would need to use external tools.

Related

Typescript extract knowledge from js object

I'm creating a ionic (cordova) product and I'd like to utilize typescript and its benefits for autocompletion optimally. But since many of the plugin objects don't stem from concrete classes I don't know how/if there is a way to utilize the knowledge from the plugin files (which are .js). If there is a way to do this I'd of course like to know this.
As mentioned in my comment you can use Typescript definition files to provide type information.
There are definition files for common Cordova plugins on Definitly Typed.
If you can't find type information for the plugin you're looking for, you can write your own definition file.
If there is a way to do this I'd of course like to know this.
Yes. Just add allowJS to true in the tsconfig.json compilerOptions. Your IDE should magically start working with .js files ;)
More
Give http://alm.tools/ a go. I wrote it with such workflows in mind 🌹

Reflect.js, What is it?

Github repo says:
Implementation of Mozilla's Parser API in JavaScript. There are few examples on github and mozilla's reference link. I have seen this library being used in one of Angular 2 seed project as well.
But what is the use of this library? Can someone explain in easy words to elaborate purpose/advantage of this library.
Thanks
It is literally just a javascript shell, much like node you can use it to write JS interactively in the shell or run JS files with it.
SpiderMonkey is Mozilla's JavaScript engine written in C/C++.
Parser, is a JS API version of that, you can use it to write tools that manipulate JS files, like a linter or compiler.
Reflect is a super old version of that which, as far as I know, is not a viable option given the other tools we have today. Note that the repo was last updated in 2012, and the JS is only ES3 compliant.

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. 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!).
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 completion 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 complete for the stuff in the 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.
Updated Answer:
Eclipse JavaScript Editor: content assist for js files, autocompletion
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 completion :
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

add jsdoc for javascript core in intellij

I am new to IntelliJ Idea
I want to add jsdoc for JavaScript core
That means, when I press the ctrl+q short key on a javascript element like .getElementsByTagName() method , I want to see the documentation, but there is not any thing!
Is there any way?
Like adding documentation jar file near to a library jar file for showing documentation.
Thanks
Mohi
Documentation is taken from the DOMCore.js stub file that doesn't contain a lot of useful information:
If you know where to find or how to generate similar stub file with complete documentation, it should be possible to use it instead.

Is there any similar JAVADOCS script/tool for Javascript files?

Trying to find a way to automate the API from javascript comments.
The JSDoc project is no longer active, you should give a look to JsDoc Toolkit.
You might also want to check the following alternatives:
YUIDoc
PDoc
JSDoc http://jsdoc.sourceforge.net/
JSDoc Toolkit
jGrouseDoc
YUI Doc
jsd100
DocumentJS
I know its a lot late but since no one mentioned, I think Docco is a great tool. I use it for javascript but this tool can be used for other types of files too.

Categories

Resources