Blogs

Rory Becker - DevExpress CodeRush Blog

CodeRush Tip – Quickly comment or uncomment code.

     

Question: “Does CodeRush have any features for helping me to quickly comment or uncomment blocks of code?”

Answer: Yes. CodeRush has function called SelectionComment.

This function comments or uncomments the currently selected block of code using the current language’s single line comment syntax.
The shortcut for this function is the same key as used for the respective language’s single line comment. (ie VB.net uses the ' key and C# or  C++ use the / key)

Simply

  • Select the appropriate code block
  • Press the key suited to that language.* (Either ' or /)

Additionally SelectionComment is actually a toggle command, which means that you can use the same key to uncomment code.

SelectionComment

 

*One small caveat

VB.Net users based in the Uk will need to adjust the SelectionComment shortcut because of the way keyboards of different nationalities and layouts handle scan codes.

The US scan code for ' is the same as the UK scan code for #

To change the key binding

  • Visit the options (Ctrl+Shift+Alt+O)
  • Navigate to IDE\Shortcuts
  • Locate the Selection\Modifying folder in the Shortcuts page.
  • Highlight the # binding
  • Place your caret in the upper right of the dialog where it says Key1: #
  • Specify the key you’d like to bind to (probably ')
  • click Ok

Everything should now be fixed.

You can learn more about binding keys in CodeRush in this blogpost

Published Apr 07 2011, 03:00 PM by Rory Becker - DevExpress
Bookmark and Share

Comments

No Comments
More from DevExpress
Live Chat
Have a pre-sales question?
Need assistance with your evaluation?
We are here to help.
Chat is one of the many ways you can contact members of the DevExpress Team. We are available Monday-Friday between 8:30am and 5:00pm Pacific Time.
If you need additional product information, require pre-sales assistance, or want help with your order, write to us at info@devexpress.com or call us at
+1 (818) 844-3383.