-
-
Notifications
You must be signed in to change notification settings - Fork 35.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adopt JSDoc for documentation #11550
Comments
I really dont like to have tons of documentation lines in the code, but since pretty much every IDE nowadays support comment folding for documentation i think its not that bad. I believe inline documentation would be a big step forward to help removing the amount of PR being created to update documentation due to changes in the API. |
Hmm... Why is that a problem? I actually prefer it that way. Avoids additional merge conflicts. |
Closing, see #12580 (comment) |
So if a new user of three.js want to change the intensity of a DirectionalLight, he or she will have to:
Why not just support JSDoc? In a modern IDE, var light = new THREE.DirectionalLight(0xffffff, 1);
light.i //(***) Auto-complete happens at (***), and it shows a tooltip saying
It's apparent that which one is better. You developers are quite familiar with the API and usage, but for a new user, NO! Even for an old user of threejs, JSDoc can also bring many benefits. Why JSDoc is important? Because it makes intellisense possible in all kinds of IDE.
See how IDEs use JSDoc for intellisense:
I would like to contribute about this. |
I searched on google for "autocomplete three.js vscode" and found this: http://shrekshao.github.io/2016/06/20/vscode-01/ Does that help? |
Is there an alternative to JSDoc that doesn't need to be part of the source? Can tern be repurposed? |
FWIW it might be possible to write JSDoc outside of the source files, and to generate API docs, examples, and autocomplete bindings from that. For example, glTF-Validator (which is compiled from Dart) does this — https://github.com/KhronosGroup/glTF-Validator/blob/master/tool/npm_template/index.js. Could imagine having a JS file that looks like: /**
* GLTFLoader is a loader for glTF 2.0 assets. Lorem ipsum...
*/
var GLTFLoader;
/**
* Parses a string or buffer to glTF asset.
* @param {string|ArrayBuffer} asset
* @param {function} onLoad
*/
GLTFLoader.prototype.parse = function ( asset, onLoad ) {};
/* ... */ That doesn't reduce maintenance really (maybe slightly easier to write docs this way than HTML, subjective opinion) but does make the result machine-readable. |
Is there a system that...?
|
Its possible to write JSDoc in separated files. But i think that threejs should really embrace inline documentation. It might be ugly (that it is) but its easy to maintain. Since it it attached to the code a person that changes code can immediately change documentation to match.
|
Does JSDoc support localisation? |
I would support this if the JSDocs can stay out of the source files. However, if we do go this path, then we really need to make the docs at |
For nunuStudio in using YUIDoc http://yui.github.io/yuidoc/syntax/index.html that can be written in separated files but does not support localization :( |
I do not think out of sync documentation is a problem. |
It will certainly be confusing for users if the online documentation and the editor inline documentation don't agree. |
Those things are temporary. |
Inline documentation
Hi, this has probably been discussed a couple of time already, i wasn't able to find recent issues regarding this).
Why not document three.js inline with code using jsdoc or similar?
That would probably help a lot to reduce documentation fragmentation and accelerate integration of new developers with already existing code? It would also help to integrate API docs in external editors (threejs editor, super powers, sublime, etc)?
I'm available to help document some of the existing code.
Thanks a lot!
Cumps
The text was updated successfully, but these errors were encountered: