https://github.com/zachhardesty7/jsdoc-comment-toggler
quickly & intelligently add, remove, or convert comments to JSDoc via VSCode extension
https://github.com/zachhardesty7/jsdoc-comment-toggler
comments documentation javascript jsdoc jsdoc-comments typescript visual-studio-code vscode vscode-extension
Last synced: about 1 month ago
JSON representation
quickly & intelligently add, remove, or convert comments to JSDoc via VSCode extension
- Host: GitHub
- URL: https://github.com/zachhardesty7/jsdoc-comment-toggler
- Owner: zachhardesty7
- License: mit
- Created: 2020-09-18T22:16:32.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-11-13T21:22:52.000Z (6 months ago)
- Last Synced: 2025-03-28T22:09:17.969Z (about 2 months ago)
- Topics: comments, documentation, javascript, jsdoc, jsdoc-comments, typescript, visual-studio-code, vscode, vscode-extension
- Language: TypeScript
- Homepage: https://marketplace.visualstudio.com/items?itemName=zachhardesty.jsdoc-comment-toggler
- Size: 1.23 MB
- Stars: 7
- Watchers: 1
- Forks: 2
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://marketplace.visualstudio.com/items?itemName=zachhardesty.jsdoc-comment-toggler)
[](https://marketplace.visualstudio.com/items?itemName=zachhardesty.jsdoc-comment-toggler)
[](https://marketplace.visualstudio.com/items?itemName=zachhardesty.jsdoc-comment-toggler)
[](https://github.com/zachhardesty7/jsdoc-comment-toggler/blob/master/LICENSE)# jsdoc comment toggler
extension to toggle a JSDoc comment on the target text, properly indenting and spacing
everythingno longer will you need to flip around between comment tags while converting a
JavaScript block or line comment into more formal JSDoc; put your cursor inside a
comment and bam## Features
- convert a line comment into JSDoc and vice versa

- convert a block comment into JSDoc and vice versa

- generate a new JSDoc comment to start documenting a variable

- generate inline JSDoc for "casting" a value with `@type`
## Usage
- command: `Toggle JSDoc Comment`
- keyboard shortcut: `ctrl+r ctrl+/` or `cmd+r cmd+/` for MacOS
- the shortcut uses chords - press the first key combination, release, and then
press the second (tip: you can hold `ctrl`/`cmd` the whole time)
- change shortcut in Preferences -> Keyboard Shortcuts -> Search "jsdoc-comment-toggler"## Extension Settings
- `jsdoc-comment-toggler.disableCursorHack` - disable a cursor hack that avoids a VSCode issue where it's impossible to add text after a cursor that's at the end of a line. In that scenario, this hack inserts a snippet with a zero-width-space after the cursor to invisibly keep the cursor in the correct position while running the edits. The extension removes the zero-width-space while adding the comment tags. This hack is safe to use because VSCode highlights the zero-width-space for you to manually remove if something fails. If you ever see a zero-width-space in a comment, please create an issue on GitHub with a reproducible case. As a workaround, you can enable this setting to prevent adding the zero-width-space and fixing the cursor position until we can address the bug.
- default: `false`
- still searching for a better way to do this and/or guarantee that a zero-width-space won't be left behind## TODO
- [ ] merge comments and JSDoc nested inside JSDoc
- [ ] wrap single line selection in parens for casting
- [ ] test placement of selection anchor and active for multiline comments
- [ ] convert to block comment when cursor is anywhere within JSDoc
- [ ] convert multiple adjacent (or empty) line comments into a single JSDoc block## Reporting issues
report any issues on the github
[issues](https://github.com/zachhardesty7/jsdoc-comment-toggler/issues) page, and please
provide as much detail as possible!## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details