Coderush code editor auto-complete features – Intellassist
The Instellassist feature of DevExpress CodeRush Pro is similar to the built-in Intellisence feature of Visual Studio. It provides additional hints that pop up as you type the code and completes the edited code with an in-scope identifier or other suggestions. These hints help you select code elements or complete the text you need in the context of what you are working on without retyping the entire text.
To use Intellassist, you should simply type a text as you would normally. Intellassist activates automatically once you type a couple of characters and it has at least a single suggestion. You can tweak the Intellassist activation for different contexts such as a code, a string or a comment. When Intellassist senses one or more suggestions matching the code you have typed so far, the best suggestion will be displayed to the right of the editor caret as a selected text:
If there are multiple suggestions, you can see the number of suggestions in a small bar under the current line and select any by cycling them as required:
The suggested text does not actually exist in the code editor, so, you can simply ignore a suggestion and continue typing without paying attention to it or accept a suggestion.
The following actions may be performed when an Intellassist hint is active:
- Press the Enter key to accept the active suggestion.
- Press the Shift+Enter key to accept a portion of the active suggestion.
- Press the Shift+Enter to accept a part of a suggestion starting from the editor caret to the character preceding the next uppercase letter in the suggestion. For example, if “MultipleSuggestionsActivationTest” was the suggestion, and the first two letters (“mu“) had been typed:
pressing Shift+Enter successive times would cause the selection to shift as follows (each picture illustrates the next Shift+Enter press):
Accepting a part of a suggestion is useful when you need to create a new identifier name that is similar to an existing identifier, or when you want to quickly access a different but similarly-named suggestion. You can press Shift+Enter to accept a part of the suggestion, and then start typing different characters to get other suggestions.
- Press the Tab and Shift+Tab shortcuts to cycle forward and backward through the list of multiple suggestions.
- Press the Delete key to cancel the active suggestion.
- Wait for a few moments and Intellassist will automatically hide the active suggestion.
- Continue typing the text completely ignoring the suggestion or narrowing down the suggestion list for further acceptance.
Intellassist suggestions are case-insensitive by default. If Intellassist suggests an identifier that is a case-insensitive match to the text you have typed, it will highlight the mismatched characters:
This is useful if you are working in a case-sensitive language such as C# or C++. For example, in the following code there are two suggestions are available for the text “us” typed:
One of the suggestions is a “userName”, which is a private field variable, and the other one is “UserName”, which is a property. The first suggestion starts with “us”. This is an exact match, so no characters are highlighted.
However, the second suggestion starts with “Us”, which is a case-insensitive match. So, an uppercase “U” is drawn over the “u” you typed, indicating changes that will occur to the code you have entered when you accept this suggestion:
Note that the icon in the hint allows you to differentiate the suggested member names.
When the case-sensitivity option is turned off, there is another option to suggest only case-sensitive matches when the text you typed contains any uppercase letters. So in the example above, entering “Us” would result in only a single suggestion – “UserName”.
Intellassist is highly configurable. On the Intelliassist Activation options page you can specify the number of characters to match before Intellassist is activated. On the Intelliassist Setup options page you can specify whether case-insensitive suggestions can be made, as well as the auto-hide and sorting options. To learn more about Intellassist options, read the appropriate topic.
Intellassist is also highly extensible. DXCore provides a special component called Intellassist Extension, which can extend the default suggestions with additional hints. Intellassist uses several extensions by default:
- Identifier Assist – the main suggestions provider, which suggests hints for the in-scope identifiers.
- Enum Assist – suggests elements of an enumeration.
- Path Assist – suggests phisical paths to the file on a disk.
To learn more on how to extend Intellassist, read the corresponding topic.—– Products: CodeRush Pro Versions: 11.1 and up VS IDEs: any Updated: Oct/18/2011 ID: C134