Home Download Buy Blog Forum Support

DocBlockr for Javascript, PHP and CoffeeScript

DocBlockr for Javascript, PHP and CoffeeScript

Postby spadgos on Thu Oct 06, 2011 1:03 am

I've put together a plugin that helps you write docblock style comments.
Code: Select all
  /**
   * These things.
   */

Source and extended README is on GitHub.

Features:
  • Comments are automatically closed, extended and indented.
  • parses the line following the comment to automatically prefill some documentation for you. eg: fills in the @param and @return tags, with tab to jump between sections for quick editing. Makes intelligent guesses about return types of functions, and uses type-hinting and default values (in PHP) to determine parameter data tyeps.
  • Double slash comments (// like this) are extended when enter is pressed.
  • Variable declarations can be documented, with inferred type information whenever possible.
  • Typing an '@' symbol inside a docblock (but only at the start of a line) will bring up a list of all valid jsdoc tags.
  • Join lines command (Ctrl/Cmd+J) works nicely in DocBlocks

Version 1 was primarily designed for Javascript (hence the repo name "jsdocs")
Version 2 now has proper support for PHP and CoffeeScript, and is designed to be able to be extended easily.

Installation is via cloning the repo into your Packages folder, or by using the Package Control plugin (search for "DocBlockr")

I'd be very happy to hear feedback, feature requests and bug reports.

Repo: https://github.com/spadgos/sublime-jsdocs
Issues: https://github.com/spadgos/sublime-jsdocs/issues

Cheers.
Last edited by spadgos on Mon Mar 05, 2012 8:51 am, edited 2 times in total.
spadgos
 
Posts: 121
Joined: Thu Oct 06, 2011 12:49 am

Re: JSDocs

Postby xavi on Wed Oct 12, 2011 11:09 pm

Great job!!

Typing @ inside a docblock show all my snippets but no JSDoc supported ones. I'm using Sublime Text 2 build 2131 on Ubuntu Linux
xavi
 
Posts: 24
Joined: Sat Jul 30, 2011 12:00 am

Re: JSDocs

Postby firefusion on Thu Oct 13, 2011 5:27 am

Awesome! Thank you.
firefusion
 
Posts: 218
Joined: Fri Oct 16, 2009 7:37 am

Re: JSDocs

Postby robin on Sat Oct 15, 2011 12:38 pm

Awesome plugin! Really missed this, most of the big IDE's got this already and now its in sublime to!

Great job :)!
robin
 
Posts: 1
Joined: Sat Oct 15, 2011 12:36 pm

Re: JSDocs

Postby spadgos on Fri Oct 21, 2011 9:26 am

xavi wrote:Great job!!

Typing @ inside a docblock show all my snippets but no JSDoc supported ones. I'm using Sublime Text 2 build 2131 on Ubuntu Linux

Hey Xavi,

I'm running on Ubuntu as well, but can't recreate your error. I do have an issue tracker on github if you (or anyone) has any problems. https://github.com/spadgos/sublime-jsdocs/issues
spadgos
 
Posts: 121
Joined: Thu Oct 06, 2011 12:49 am

Re: JSDocs

Postby spadgos on Sat Nov 05, 2011 5:10 pm

Hi all,

I've just released an update to the JSDocs package:

From the changelog
v1.3.0, 5 November 2011
Improvements to handling of single-line comments
Functions beginning with is or has are assumed to return Booleans
Consolidated settings files into Base File.sublime-settings. If you had configured your settings in jsdocs.sublime-settings, please move them to the Base File settings.
Setting jsdocs_extend_double_slashes controls whether single-line comments are extended.
Pressing tab in a docblock will tab to match the description block of the previous tag. Use jsdocs_deep_indent to toggle this behaviour.

Here's a demonstration of that last bullet point:
Code: Select all
/**
* @param {String} foo Lorem ipsum dolor sit amet
* |<<tab>>
*/

-- becomes

/**
* @param {String} foo Lorem ipsum dolor sit amet
*                     |
*/


Please do give it a try and let me know if you find any problems or have any feature requests by submitting an issue on the Github tracker: https://github.com/spadgos/sublime-jsdocs/issues

Cheers!
spadgos
 
Posts: 121
Joined: Thu Oct 06, 2011 12:49 am

Re: PHP+JSDocs

Postby spadgos on Sun Nov 06, 2011 9:08 pm

Hey guys,

Don't mean to be spamming, but I've released version 2.0.0 of JSDocs which now officially supports PHP. I've edited the post at the start of this thread, but the readme on the github repo has the most info.

Give it a try and let me know how it is!
spadgos
 
Posts: 121
Joined: Thu Oct 06, 2011 12:49 am

Re: PHP+JSDocs

Postby manu on Tue Nov 08, 2011 3:25 pm

Thank you spadgos,

It works well, it's a real pleasure to not type thousands of '*' :D
manu
 
Posts: 1
Joined: Tue Nov 08, 2011 1:25 pm

Re: PHP+JSDocs

Postby spadgos on Sat Nov 19, 2011 3:12 pm

I've just released an update, now at version 2.1.0. From the changelog:

- Added a command to join lines inside a docblock which is smart to leading asterisks Press Ctrl+J to join lines
- Variable types are guessed from their name. `is` and `has` are assumed to be Booleans, and `callback`, `cb`, `done`, `fn` and `next` are assumed to be Functions.
- You can now define your own patterns for mapping a variable name to a type. See the README for documentation about the format
- Autocomplete works better now. `@` will also insert the "@" character, allowing you to add any tag you like, even if it isn't in the autocomplete list.
- Added the full set of PHPDoc tags.
spadgos
 
Posts: 121
Joined: Thu Oct 06, 2011 12:49 am

Re: DocBlockr for Javascript, PHP and CoffeeScript

Postby spadgos on Mon Mar 05, 2012 8:52 am

I thought I'd give this thread a bump since I've just added support for CoffeeScript.
spadgos
 
Posts: 121
Joined: Thu Oct 06, 2011 12:49 am

Next

Return to Plugin Announcements

Who is online

Users browsing this forum: Google [Bot] and 7 guests