CodeRush Tricks of the Trade [closed]

我们两清 提交于 2019-11-29 19:46:49
Rob Allen

I recently installed the Xpress version and went on a similar hunt. This cheat-sheet is what I found so far. The XPress version is pretty gimped BTW so I'm trying to get funding for a license.

Echostorm

I use these a lot:

  • / will comment or uncomment highlighted blocks of code.

  • b will wrap a highlighted selection in braces.

  • Ctrl + 3 will wrap a selection into a region.

  • tc will generate a try/catch block.

  • mbs will write a MessageBox.Show(""); and drop the cursor in the quotes.

  • cws will do the same but with Console.Writeline.

  • m will create a method block (ms would do a method block that returns type string).

  • . will make a comment block.

moobaa

NumPad+Plus widens the scope of your selection one level.

Try it. It's sublime :)

Rory Becker

F2 - Rename

Strictly this is a RefactorPro shortcut as the Rename functionality is for RefactorPro. (However since RefactorPro is included in the Price of CodeRush that should not be an issue)

It is also, I think, Disabled by default.

You should be able to use the DevExpress\Options...\IDE\Shortcuts screen to search for F2 and re-enable it.

Very natural to rename Vars and Methods using F2 when you're already used to F2 functionality for Files and Folders in Explorer.

Rory Becker

Search for Type

QuickNav (Ctrl+Shift+Q) can be a bit excessive at times....

If you know you're looking for a Type, bind Ctrl+T to QuickNav using additional params of "AllTypes,, AllVisibilities, CurrentSolution" (without quotes)

This will allow you to search for only Types in the current solution

These params can be tweaked to your liking. See http://community.devexpress.com/forums/p/66380/225556.aspx#225556 for details

rt / rf = For Return True and False

Search for Member

QuickNav (Ctrl+Shift+Q) can be a bit excessive at times....

If you know you're looking for a Method, bind Ctrl+M to QuickNav using additionial params of "AllTypes, AllMembers, AllVisibilities, CurrentFile" (without quotes)

This will allow you to search for only Members in the current file.

These params can be tweaked to your liking. See http://community.devexpress.com/forums/p/66380/225556.aspx#225556 for details

Here is a simple CodeRush Template for generating guard clauses.

Type inx space within a method, whilst you have a variable reference on the clipboard and you'll get...

If [VariableName] Is nothing Then
    return 
End If 

or

if ([VariableName] == null)
{
    return;
}

... depending on the language you're currently operating in.

This Template is often referred to within DevExpress Webinars as If Not Null or If Null Exit

This is an old post on the DevExpress Coderush Forum:

In it is a setting suggestion by Mark Miller to enhance the default "Embed in Parenthesis" feature of CodeRush.

Once in place ... highlight some text and hit '('. your selection will be wrapped in Parenthesis and more importantly your caret will be on the left of the selection. (Similar applies to the Right Parenthesis)

Ideal for VB.Net users to use alongside CInt, CStr etc

CR_MetricShader: is a free open source plugin for CodeRush or CodeRush Xpress which will allow you to see visually when your method's complexity is getting out of hand.

It alters the background color of your method to indicated severity with respect to your chosen Metric.

Works with the built in metrics of CodeRush (and the hidden ones in CodeRush Xpress) aswell as being compatible with any you might choose to create yourself.

Chensformers

Inside VS.NET

Press "Ctrl + Shift + Alt + O" will list all the DX Options (and putting shortcuts in the search box will bring you to the keyboard bindings)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!