Intelligent Line Commenting

Ideas for new features

Moderators: AmigoJack, helios, bbadmin, Bob Hansen, MudGuard

Post Reply
User avatar
ds0934
Posts: 41
Joined: Thu Nov 18, 2004 2:06 pm
Location: Virginia, USA
Contact:

Intelligent Line Commenting

Post by ds0934 »

I've tried the macros for commenting lines of code, but they seem to work best for only certain languages. I would like to see a menu/keyboard feature to "Comment/Uncomment" selected lines where it uses the comment setting from the syntax file for the detected document class. I should be able to select the lines of code, and either click on a menu item or press something like CTRL+K or whatever, and have it insert or remove (toggle) comment character insertions.

Better than that, would be for languages that support multi-line comments, like PHP, C++, Perl, Java, PowerShell, it would insert only two demarkations in the file (start and end symbols) where languages that do not (ie. VBscript) simply inserts the single-line comment character on each selected line. Even if it could only do the latter for all languages that would be very helpful.
User avatar
Drxenos
Posts: 210
Joined: Mon Jul 07, 2003 8:38 pm

Post by Drxenos »

The advantage of single-line comments is there are no issues with existing comments for languages that don't allow multi-line comments to nest. When I setup commenting macros, I always use single-line comments for this very reason. I can comment-out a block without regard for what the block contains. That is not always possible with multi-line comments, or even the preprocessor (for languages that have one).

I do, however, like your idea about having the same keyboard shortcuts that will comment/uncomment regardless of the language. That would be nice.


DrX
Last edited by Drxenos on Mon Nov 22, 2010 2:34 pm, edited 1 time in total.
Faded Giant
Posts: 6
Joined: Tue Nov 16, 2010 4:51 pm

Post by Faded Giant »

I would like to see this feature also!

Not to sound selfish, but I've been using MS Visual Studio and Cypress PSoC Designer for several years, and have become a frequent user of this feature. Both of these environments use Ctrl-K, C (Hold Ctrl, press K, while still holding Ctrl, press C) to comment a selection, and Ctrl-K, U to un-comment a selection.

For single-handed mouse operations, you can select several lines, then click on one of two icons in the toolbar to comment/un-comment.
I would include images of these, but I am new to this forum (or any other forum for that matter) and I don't understand how to use the "Img*" button to attach a picture.
peterl
Posts: 9
Joined: Mon Jul 23, 2007 11:01 pm
Location: Sydney, Australia
Contact:

Agree

Post by peterl »

I agree too this would be good.
IDEs often use Ctrl-3 or Alt-3 to comment and Ctrl-Shift-3 or Alt-Shift-3 to uncomment. I like this because # is used by lots of scripting languages for commenting, so it's an obvious one to remember.
Post Reply