Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically "continue" a comment block in Sublime when pressing enter?

I'm sure there's an answer out there but due to the ambiguity of this question and keywords it's difficult.

All I want is a commenting plugin or answer to mimic Java in Eclipse where:

/* 
 * This is a description of a function in Javascript
 * When I press return a line like this
 *
 * should appear (above) and allow me to continue the comment block
 * and be surrounded by the following
 */

UPDATE/ANSWER

A few minutes after I posted this user pst came in and rephrased my question to actually make sense. After searching I found DocBlockr. Works great, thank you both!

like image 495
jasonsemko Avatar asked Nov 27 '12 20:11

jasonsemko


People also ask

How do I comment multiple lines in Sublime Text?

To add single-line comments, put the text cursor on the line to comment-out or highlight multiple lines and type CMD + / on Mac, for Linux and Windows use CTRL + / .

How do I comment a line in HTML Sublime Text?

Open the console (View->Show Console) and write this in it: sublime. log_commands(True) and press Ctrl+/ and Ctrl+Shift+/ .

How do I move a line up and down in Sublime Text?

CTRL-SHIFT-UP (PC) or CTRL-⌘-UP (Mac) moves a line up, while CTRL-SHIFT-DOWN (PC) or CTRL-⌘-DOWN (Mac) moves a line down.


1 Answers

Start with the DocBlockr package.

If you enter and align the first * it will insert the following starting *s.

/*
 * <-- Type and align that one, hit <RETURN>...
 * <-- This one will be inserted and aligned automatically.

If you insert a double-asterisk it will insert the leading *s without the hinting:

/**
 * <-- Inserted automatically.

If you're at the start of a function it'll put the JsDoc stuff in for you as well.

like image 167
Dave Newton Avatar answered Oct 19 '22 07:10

Dave Newton