GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing raw.githubusercontent.com — raw.githubusercontent.com # DocBlockr
DocBlockr is a package for [Sublime Text 2 & 3][sublime] which makes writing documentation a breeze. DocBlockr supports **JavaScript** (including ES6), **PHP**, **ActionScript**, **Haxe**, **CoffeeScript**, **TypeScript**, **Java**, **Apex**, **Groovy**, **Objective C**, **C**, **C++** and **Rust**.
## Installation
### [Package Control](https://sublime.wbond.net/installation)
1. Open Package Control: `Preferences -> Package Control`
2. Select `Package Control: Install Package`
3. Type `DocBlockr` into the search box and select the package to install it
## Feature requests & bug reports
You can leave either of these things [here][issues]. Pull requests are welcomed
heartily, but please read [CONTRIBUTING.md][contrib] first! Basically: in this
repo, the main development branch is `develop` and the stable 'production'
branch is `master`. Please remember to base your branch from `develop` and issue
the pull request back to that branch.
## Show your love
[](http://pledgie.com/campaigns/16316)
## Changelog
- **v2.14.1**, *17 Aug 2015*
- Fix deindentation bug with reparsing doc blocks
- **v2.14.0**, *15 Jun 2015*
- Adds `jsdocs_function_description` option (thanks to [Gerard Roche](https://github.com/gerardroche))
- Better handling of parser errors (thanks to Gerard Roche)
- **v2.13.3**, *4 Jun 2015*
- PHP array shorthand is identified correctly (thanks to [Gerard Roche](https://github.com/gerardroche))
- Decorating comments when using tabs for indentation works better (thanks to [Jack Cherng](https://github.com/jfcherng))
- **v2.13.2**, *30 Mar 2015*
- Updated PHPDoc autocompletions to align with the new spec (thanks to [Gerard Roche](https://github.com/gerardroche))
- Properly handle the case when commas appear inside a type name in Java
- Added link to README in the preferences menu
- **v2.13.1**, *29 Mar 2015*
- Adds support for Apex language (thanks @michacom)
- Fixes identifying multidimensional arrays in C/C++
- Fixes reformatting and reparsing docblocks in Java
- Adds options to disable:
- opening an inline docblock with space (`jsdocs_quick_open_inline`)
- inline comment decoration (`jsdocs_decorate`)
Older history can be found in [the history file][history].
## Usage
> Below are some examples of what the package does. Note that there are no keyboard shortcuts required to trigger these completions - just type as normal and it happens for you!
### Docblock completion
Pressing **enter** or **tab** after `/**` (or `###*` for Coffee-Script) yields a new line and closes the comment.

Single-asterisk comment blocks behave similarly:

### Function documentation
However, if the line directly afterwards contains a function definition, then its name and parameters are parsed and some documentation is automatically added.

Press Tab to move forward through the fields, press Shift+Tab to move back through the fields.
If there are many arguments, or long variable names, it is sometimes useful to spread the arguments across multiple lines. DocBlockr handles this situation too:

In languages which support [type hinting][typehinting] or default values, then those types are prefilled as the datatypes.

DocBlockr will try to make an intelligent guess about the return value of the function.
- If the function name is or begins with "set" or "add", then no `@return` is inserted.
- If the function name is or begins with "is" or "has", then it is assumed to return a `Boolean`.
- In Javascript, if the function begins with an uppercase letter then it is assumed that the function is a class definition. No `@return` tag is added.
- In PHP, some of the [magic methods][magicmethods] have their values prefilled:
- `__construct`, `__destruct`, `__set`, `__unset`, `__wakeup` have no `@return` tag.
- `__sleep` returns an `array`.
- `__toString` returns a `string`.
- `__isset` returns a `bool`.
- In ES6 Javascript, generator functions get a `@yield` tag instead of `@return`
### Variable documentation
If the line following the docblock contains a variable declaration, DocBlockr will try to determine the data type of the variable and insert that into the comment.
Press space or shift+enter after an opening `/**` to insert an inline docblock.

DocBlockr will also try to determine the type of the variable from its name. Variables starting with `is` or `has` are assumed to be booleans, and `callback`, `cb`, `done`, `fn`, and `next` are assumed to be functions. If you use your own variable naming system, (e.g. hungarian notation: booleans all start with `b`, arrays start with `arr`), you can define these rules yourself. Use the `jsdocs_notation_map` setting, example:
```js
{
"jsdocs_notation_map": [
{
"prefix": "b", /* a prefix, matches only if followed by an underscore or A-Z */
"type": "bool" /* translates to "Boolean" in javascript, "bool" in PHP */
},
{
"regex": "tbl_?[Rr]ow", /* any arbitrary regex to test against the variable name */
"type": "TableRow" /* you can add your own types */
}
]
}
```
The notation map can also be used to add arbitrary tags, according to your own code conventions. For example, if your conventions state that functions beginning with an underscore are private, you could add this to the `jsdocs_notation_map`:
```json
{
"prefix": "_",
"tags": ["@private"]
}
```
### Comment extension
Pressing enter inside a docblock will automatically insert a leading asterisk and maintain your indentation.


This applies to docblock comments `/** like this */` as well as inline double-slash comments `// like this`

In either case, you can press `shift+enter` to stop the automatic extension.
Oftentimes, when documenting a parameter, or adding a description to a tag, your description will cover multiple lines. If the line you are on is directly following a tag line, pressing Tab will move the indentation to the correct position.

### Comment decoration
If you write a double-slash comment and then press `Ctrl+Enter`, DocBlockr will 'decorate' that line for you.
// Foo bar baz< |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |