Archive

Archive for the ‘Code Generation’ Category

Creating custom CodeRush Code Embeddings

September 12th, 2011 Comments off

CodeRush Code Embeddings are completely customizable. They are modified on the Embeddings options page in the Options Dialog, where you can create your own. Let’s add a new code embedding to surround the selected code with the logging capabilities.

Read more…

CodeRush Code Embeddings Options

September 12th, 2011 Comments off

The Embeddings options page allows you to customize or remove the predefined CodeRush Code Embeddings and create your own for any registered language. The options page is located at the Editor | Selections | Embeddings path inside the CodeRush Options Dialog. Here is what is looks like:

Read more…

Code Providers – Embed Selection

September 12th, 2011 2 comments

The Embed Selection code provider allows you to wrap the selection into the predefined code blocks from the Code Embedding feature of CodeRush. The code provider is available when a whole line or multiple lines are selected and at least one embedding is predefined for the current language.

Read more…

Wrapping code blocks with the CodeRush Code Embeddings feature

September 12th, 2011 Comments off

CodeRush Code Embeddings allow you to wrap the selected code block or any text into another predefined code block, such as: try/catch, try/finally, using and lock statements, while and other loops, region directives, etc. Code Embeddings are available via the predefined keyboard shortcuts, via the Embed Selection code editor context menu item, or using the Embed Selection code provider.

Read more…

Declaring various properties using CodeRush code generation tools

August 18th, 2011 Comments off

The consume-first declaration features of CodeRush are a quick way to generate the required code without typing the entire declaration’s code by hand. Once you have a reference to an undeclared member, pressing the CodeRush key allows you to choose a member you would like to declare. Let’s take a look at the property-declaring code generation providers you can use.

Read more…

Code Generation – Create Descendant and Create Descendant (with virtual overrides)

June 30th, 2011 2 comments

The Create Descendant code provider shipped in CodeRush generates a descendant class for the active class, providing overrides for abstract members, if any. The second version of the code provider named Create Descendant (with virtual overrides), in addition to the Create Descendant, adds overrides for virtual members into a descendant class.

Read more…

Code Generation – Create Ancestor

June 29th, 2011 4 comments

The Create Ancestor code provider generates a new base class declaration for the active class. The generated base class will be declared above the active class and the active class becomes a descendant of the new base class. The new base class has the same visibility as the active class and contains the default public parameterless constructor. All identifiers and references of the base class are linked together for easy renaming.

Read more…

Code Generation – Declare Interface

June 29th, 2011 Comments off

The Declare Interface code provider generates a new definition of an interface and adds interface referenced members to it, if any. The declaring provider is available on an undeclared type reference, that starts with an upper-case letter I, e.g. ILogger.

Read more…