Archive

Author Archive

How to create shortcuts for refactorings that require a sub-menu choice

March 20th, 2012 Comments off

There is a built-in capability in CodeRush/DXCore to create shortcuts for any type of content providers, such as refactoring and code providers. Just choose the Refactor command and type in a provider’s name as a parameter. However, this approach does not work for refactorings that require a sub-menu choice; for example:

Read more…

Adding and removing block delimiters in C#/C++ and JavaScript

March 12th, 2012 3 comments

In C#, C++ and JavaScript languages, curly braces are used as block delimiters. A block allows multiple statements to be written inside. If a block contains a single statement, block delimiters, in most cases, are optional. For example, a single statement inside a loop does not require block delimiters:

CodeRush Optional block delimiters sample

Read more…

Creating a new code issue and its fix for Java Script

March 6th, 2012 Comments off

The process of adding a new CodeRush code issue and a code fix provider for the code issue in the Java Script language is the same as for any other supported language. As an example, we are going to add a code issue that will highlight the “for..in” loop with the following structure:

Read more…

Changing an explicit cast-expression to an ‘as’ operator and back

February 16th, 2012 Comments off

Objects can be converted from one type to another, assuming that the types are compatible. Often this is achieved using implicit conversion or explicitly with the cast operator. To perform an explicit casting, there are two approaches used:

  • a cast-expression
  • an ‘as’ operator

Read more…

Code Providers – Create Event Trigger

February 16th, 2012 2 comments

The Create Event Trigger CodeRush code provider generates an event trigger for the specified event. An event trigger is a single method that is used to raise an event. Although it is not strictly necessary to create such a trigger, it is useful, as it makes maintenance of the code simpler.

Read more…

DXCore Services – Text Classification

February 14th, 2012 Comments off

The Text Classification DXCore service provides methods for Visual Studio 2010+ text classification manipulation. A text classification logically classifies the content of the code editor (e.g., the text behind the code editor) and highlights elements of the editor content matching a classification. A classifiers main task is to recognize elements of the underlying text buffer and highlight those that match a classification type.

Read more…

DXCore Services – PlugIn Extensions

February 14th, 2012 Comments off

The PlugIn Extensions DXCore service provides access to registered DXCore plug-in extensions.

The service contains several overloads of the Find method that searches for a plug-in extension based on a stored property value. Stored properties are used by the plug-in loader to retrieve information without demand-loading the plug-in in which this extension is contained. This should only be used in special circumstances.

Read more…

DXCore Services – Code Modification

February 14th, 2012 Comments off

The Code Mod (Modification) DXCore service provides APIs for code generation and code declaration, and access to the code provider extensions.

Read more…