Reputation: 1869
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?
Upvotes: 173
Views: 160859
Reputation: 4952
Visual Studio Code 1.10 is now able to generate JSDoc comments.
Just type /**
above the function
See Also:
Upvotes: 320
Reputation: 4398
The best result for me (in 2023) was with JSDoc Generator
:
https://marketplace.visualstudio.com/items?itemName=crystal-spider.jsdoc-generator
It was the only one that I found that works fine, as VS Code integrated JSDoc comment
didn't add the types, oouo-diogo-perdigao.docthis
didn't add the types properly in @return
, several old extensions were dead, etc.
Upvotes: 3
Reputation: 535
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
settings.json
"macros": {
"JSDoc": [
{"command": "type", "args": {"text": "/**"}},
"insertSnippet"
]
}
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.
Upvotes: 4
Reputation: 601
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.
Upvotes: 0
Reputation: 2474
I really like "Document This".
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.
Upvotes: 39
Reputation: 27395
A related one.
I was finding for Visual Studio 2017 Community edition, below helped:
https://marketplace.visualstudio.com/items?itemName=MichaelObermeyer.DocStubsJs2017
Upvotes: 2
Reputation: 123744
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
Upvotes: 17