Page 1 of 1

Automatic starrey comments.

Posted: Thu May 25, 2006 11:46 am
by xconspirisist
When you comment your code in large blocks (javadoc):

Code: Select all

/** 
 * This is a comment
 * 
 * blaat.
 */
It would be nice, when you tap enter, to automatically indent by a space, and add the * character to a new line.

Posted: Thu May 25, 2006 2:50 pm
by talleyrand
Not quite sure what you mean by "tap enter" but you could bind a macro to whatever keystroke you feel is handy. You could also probably bind a keystroke to hit the clip library to insert the comment block.

Posted: Fri May 26, 2006 8:00 am
by SteveH
I think what is meant is effectively a pretty advanced form of code snippets. This would mean that once a block comment was started it would continue to create comment marks automatically until stopped.

The only app I have seen that does this is TextMate on Mac OS X. There is a screencast of this in action at http://macromates.com/screencast/scopes ... mments.mov but beware, it is about 61MB. It illustrates how to cause return (↩) to also insert an asterisk when used inside block comments such as:

Code: Select all

/* This is a block comment
 * which spans a few lines
 */

Posted: Fri May 26, 2006 2:45 pm
by Bob Hansen
How about a macro that inserts Blocked Comments from the clip library, selects that blocked section and does a Search for "\n" and replace with "\n *" .

That macro could be assigned a hot key, and could be easily triggered to run when needed.

Posted: Fri Jun 23, 2006 6:06 am
by I Steal Toast
Can you not just

Code: Select all

/* Write your block comments
like this, without a star on
every line? */
It makes it easier to comment and uncomment large blocks of code that way, and the syntax highlighting should already make it fairly obvious what is and isn't a comment, so adding stars is a bit redundant IMO.