add jsdoc for javascript core in intellij - javascript

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.

Related

PhpStorm and JavaScript: how to get full doc support

I use PhpStorm 2017.1.4 IDE. When I code in PHP, the core functions are all documented in the IDE (beyond just the parameters, I can see what the function does etc..)
I'm now practicing my JavaScript. Although the IDE knows the core functions, there is no documentation:
So find myself always going on MDN reference to learn about functions, which really slows down my work. How can I shore up my IDE to provide fuller documentation?
Quick documentation popup opened on F1 (or Ctrl+Q) shows information written in comments attached to object in .js file object is defined in (plugins\JavaScriptLanguage\lib\JavaScriptLanguage.jar!\com\intellij\lang\javascript\index\predefined\EcmaScript.js in your case). You can create a copy of this file somewhere on your disk, add more doc comments to functions stubs, and add this modified file as a JavaScript library to your project
If you like to see full API docs, hit Shift+F1, or press blue 'up' arrow button in documentation popup toolbar (note that this function is only available for libraries that have 'documentation URL' configured)
See https://www.jetbrains.com/help/webstorm/2016.2/viewing-inline-documentation.html

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 🌹

WebStorm: How to generate JSDoc documentation

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.

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

Which comments documentation format is better for JavaScript?

Is there are any comments documentation format for JavaScript and processor for this format which generates HTML documentation?
Currently I am using VSDoc xml comments for providing IntelliSense help at developing time, but as I know there is no documentation generator for such comments.
So alternatively my question may sounds like: Is there are any utility which translates VSDoc comments from JavaScript files to HTML?
Have you looked at auto generated documentation from JavaDoc or VSDoc or JSDoc or anything like that.
They are all ugly and un-readable.
The solution is two fold
annotate your code with docco
Make your API documentation hand written.
There is a third option which is to revolutionize the way we do auto generated documentation, if you can then please do.
I've used Natural Docs for a few projects. The syntax is nice for reading the inline, but since it doesn't have "full language support" for JavaScript, you have to be somewhat explicit about each function/constant/class/whatever you want to document.
There is a utility that parses Javascript files and outputs the same XML format NDoc and Sandcastle use: AjaxDoc
That way you get the VS intellisense from the same comments and can output any format that you want.

Categories

Resources