Code Completion (IntelliSense)
ReSharper complements and extends Visual Studio's native code completion (IntelliSense) with more advanced capabilities. For example, it narrows down the list of suggestions based on your typing, automatically imports selected types and extension methods, adds parentheses when completing method names, suggests variable and field names depending on their types, and more.
To get you familiar with ReSharper's code completion features, here are some implementation basics:
By default, ReSharper replaces native Visual Studio's IntelliSense with its own features.
The suggestion list of
Automatic Completion appears as soon as you start typing a new identifier.
Thw suggestion list of
Basic Completion appears when you press the default Visual Studio
If necessary, you can always return to the native Visual Studio's IntelliSense. To do so, select Visual Studio on the Environment | IntelliSense | General options page.
- Two other completion commands, Smart Completion (Ctrl+Shift+Space) and Import Symbol Completion (Ctrl+Alt+Space) are available always, independently of the selected option for standard completion commands.
- All ReSharper's completion shortcuts can be pressed several times in succession. In this case, ReSharper adds new suggestions to the completion list. For more information, see Double Completion.
By default, all ReSharper's completion features support
CamelHumps, i.e. you can type the initial letters of
a compound name parts and the name will appear in the list of suggestions.
If necessary, you can disable CamelHumps by clearing the Match middle of identifiers check box on the Environment | IntelliSense | Completion Behavior options page.
Here are some other general points that show how ReSharper's code completion features are different from Visual Studio's native IntelliSense:
- As you type, the list of completion suggestions is narrowed down to match your input. If necessary, you can turn this off by clearing the corresponding check box on the Environment | IntelliSense | Completion Behavior options page. You can also specify the initial size of the completion list using the corresponding option on the Environment | IntelliSense | Completion Appearance options page.
- Immediate members of a type are emphasized, as opposed to inherited members.
- When you select a suggestion in the list, ReSharper displays its summary taken from the XML documentation. You can disable this by clearing the Show summary check box on the Environment | IntelliS ense | Completion Appearance options page.
- By default, all overloads of a method are shown as a single method name without a signature in the suggestion list. When you select it, the list of overloads, if any, appears in a pop-up where you can study them. To switch between signatures in the pou-up, you can press Ctrl+P. If you want to see each signature of an overloaded method separately in the completion list, select Show member signatures on the Environment | IntelliSense | Completion Appearance options page.
- Where applicable, Code Completion suggests indexers along with type members, and corrects expression syntax accordingly if an indexer is selected.
- Custom icons for parameters and local variables are provided to distinguish them from fields.
- When you use code completion over existing code items, you can either simply insert the selected completion suggestion by pressing Enter or substitute the existing identifier with the selected suggestion by pressing Tab (If necessary, you can change the default shortcuts on the Environment | IntelliSense | Completion Characters options page).
- When you declare a field, method parameter, or local variable, ReSharper suggests a list of possible names to choose from taking into account other names in the current context and your naming rules.
In this section: