Skip to main content
A newer version of this page is available. .

Code Providers

  • 2 minutes to read

Code Providers are CodeRush features that enable you to automatically perform routine changes in your code.

CodeRush adds refactorings, code providers, and code formatters to Visual Studio's light bulb menu (Code Actions Menu). To invoke the Code Actions Menu, put the caret on the part of the code you need to change, press Ctrl + . or Ctrl + ~, and choose the required action from the invoked menu. When the cursor is on a Code Action Menu item, you can see a preview of the changes that will be made to your code.

Code_Generation_Main

Entries in the Code Actions Menu fall into the following categories:

  1. Code Formatters — do not change code behavior, but can improve code readability and layout to match a certain style. For instance, Sort Namespace References.
  2. Refactorings — do not change code behavior, but can simplify your code, improve readability, make code more flexible (for future changes), or bring the code to meet certain standards. For instance, Inline Method.
  3. Code Providerscan change code behavior or declare undeclared types and members. Use them to supplement your code with blocks which you might want to type manually. For instance, Create Event Trigger.

This section describes each Code Provider in detail. The description includes the purpose of the Code Provider, its availability and a usage example.

Target Picker

A number of Code Providers allow you to choose the place used to insert the new code. The feature utilized for that is called Target Picker.

TargetPicker

To move the Target Picker, use the Up Arrow and Down Arrow keys. To pick the current location, hit Enter. The appearance of the Target Picker can be configured in the Editor | All Languages | Code Actions | Target Picker options page.