Is there a way to generate JSDoc comments in Visual Studio Code
Visual Studio-CodeJsdocVisual Studio-Code Problem Overview
I am currently developing a NodeJS project and found out that there is no built in functionality to create JSDoc comments for functions/methods.
I am aware of the TypeScript definitions that exist but I couldn't really find anything to match what I need.
WebStorm, for example, has some pretty neat JSDoc functionalities. Can one somehow achieve a similar functionality?
Visual Studio-Code Solutions
Solution 1 - Visual Studio-Code
Visual Studio 1.10 is now able to generate JSDoc comments.
Just type /**
above the function
See Also:
Solution 2 - Visual Studio-Code
I really like "Document This".
Installation
Launch VS Code Quick Open (⌘+P), paste the following command, and press enter.
ext install docthis
https://marketplace.visualstudio.com/items?itemName=oouo-diogo-perdigao.docthis
It has some nice features like adding doc blocks to an entire file.
Solution 3 - Visual Studio-Code
Maybe give this JSDoc extension a try: https://marketplace.visualstudio.com/items/stevencl.addDocComments
You can install extensions in VS Code from View
> Command Palette
Solution 4 - Visual Studio-Code
A related one.
I was finding for Visual Studio 2017 Community edition, below helped:
https://marketplace.visualstudio.com/items?itemName=MichaelObermeyer.DocStubsJs2017
Solution 5 - Visual Studio-Code
For anyone who, like me, is to lazy to type /** every time they want to insert some JSDoc comments I found the following solution to be quite effective. Note this is implemented with code-server 3.12.0
- Install the macros extension https://github.com/geddski/macros
- Add the following block to your
settings.json
"macros": {
"JSDoc": [
{"command": "type", "args": {"text": "/**"}},
"insertSnippet"
]
}
- Add the following to your
keybindings.json
{
"key": "ctrl+shift+/",
"command": "macros.JSDoc",
"when": "editorFocus"
}
Now whenever you type ctrl+shift+/
intellisense autocomplete will pop-up, hit enter and enjoy.
Solution 6 - Visual Studio-Code
https://marketplace.visualstudio.com/items?itemName=kimlimjustin.jsdoc-generator
just select the whole function till the first block {
and command vscode to generate jsdoc. works with arrow functions/typescript.