- DocBlockr
- Nova extension to make writing documentation easier
- 5174 Installs
Readme
DocBlockr for Nova
Nova extension to make writing documentation easier.
DocBlockr helps you add documentation comments to your source code. Just type /**
in the editor and select the completion suggestion.
If the line directly afterwards contains a function definition or variable declaration, some documentation is automatically added with placeholders you can tab through. DocBlockr will try to make an intelligent guess about the return value of a function.
To (re-)format a comment block select it (or just place the cursor inside) and select Editor → DocBlockr → Format DocBlock.
DocBlockr for Nova currently supports * C/C++, LSL * Java * JavaScript/JSX * ObjC/ObjC++ * PHP * Ruby (experimental) * Rust * Swift (experimental) * TypeScript/TSX
You can read more about documentation comments here: JSDoc and phpDocumentor.
Header blocks
DocBlockr may additionally provide a header comment, if the cursor is at the top of your source file. Header comments start with the file and workspace name. You may add more tags globally or per workspace in the extension settings, e.g.:
- pre-filled tags: e.g. @copyright year name
- tags only: e.g. @author (in which case DocBlockr adds the missing placeholders according to the specification for that tag)
- free-form text
Each of these also accept tabbable ${placeholders}
and Nova variables, e.g.
@copyright ${year} $AUTHOR_NAME
Note
This started as a port of DocBlockr for Atom by Nikhil Kalige, which is a port of DocBlockr for Sublime Text by Nick Fisher. By now large parts of the original code were refactored and I basically kept the RegExp only. More or less.
Special Thanks
Portuguese translation by Gwyneth Llewelyn
Changelog
Version 0.9.2
- Bugfix: Menu command Insert DocBlock and Format DocBlock should work again (has nobody noticed this was broken?).
- Updated README to better illustrate how additional tags for header comments work.
- New feature: Bookmark comments
Version 0.9.1
Version 0.9.0
- Note: DocBlockr is now using language specific trigger chars, i.e.
/**
for Java/Javascript/PHP/etc./**
or/*!
for C languages (depending on selected comment style)///
for Rust/Swift##
for Ruby- Added support for Swift (experimental)
- Added support for Ruby (experimental)
- Some Rust comment enhancements (following rust-lang RFC 1574)
- Extension settings: Fixed a bug which prevented free-form text to be added to header comment blocks. Also, made the tab index for placeholders optional:
${placeholder}
and${0:placeholder}
now both work. - More bugfixes
Version 0.8.0
- Added support for Java, ObjC/ObjC++ and Rust. There may be issues!
- v0.6.1 introduced new bugs, so I reviewed the whole code and found even more bugs and weird stuff some of which I for the life of me can't remember why I did.
- Additionally Nova’s indentation logic breaks DocBlockr in many cases, so I have also rewritten that part. Hoping this won’t introduce new bugs.
Version 0.7.0
- C/C++ support
- Portuguese translation by Gwyneth Llewelyn
- German language additions (Gwyneth Llewelyn)
Version 0.6.1
- Bugfix
Version 0.6
- Added basic support for JSX/TSX files. Enabling JavaScript also enables it for JSX. Same for TypeScript/TSX.
Version 0.5
- Comment extension (experimental feature) Pressing return inside a docblock will try to insert a leading asterisk and maintain indentation. This is very hacky code, which constantly tracks cursor position and docblock contents. This may slow down your editor, which is why this is an experimental feature and disabled by default. Can be enabled in global settings.
- minor fixes
Version 0.4
- Custom tags for header blocks (global and per workspace)
- bug fixes
Version 0.3
- Better handling of different line endings
- Completions now also provide a header block as first comment in a document Additional/default fields for this will be added in v0.4
- Added menu command to add docblocks
- Added menu command to (re-)format docblocks Wrap width is currently hard-coded to 80 characters
- more code cleanup
Version 0.2
- Tag completions (@...)
- Reworked preferences handling
- Catching false positives Statements which look like functions to DocBlockr (if, for, switch, while)
- some code cleanup
Version 0.1
First halfway decent working version
License
MIT License
Copyright (c) 2021 Hendrik Meinl
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.