ReSharper 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, understands lowerCamelHumps abbreviations, suggests variable and field names depending on their type names and your naming style, automatically imports selected types and extension methods, and more.
Ctrl+Space code completion recognizes variables and methods, currently visible type names, keywords, and more. ReSharper automatically suggests prefixes when declaring identifiers, according to your naming style.
ReSharper even provides completion for unresolved symbols in local scope: even if a code symbol is not declared, ReSharper grabs its known members from its usages.
All ReSharper's code completion features including symbol completion support CamelHumps — that is, you can complete any item by entering only its uppercase characters.
In ASP.NET files, ReSharper also provides code completion for web control properties and
events, data sources, content
placeholders, and of course, inline C# code.
When it comes to XAML, you have
assistance
with references
to resources, whereas in build scripts, ReSharper helps you with property, target, task,
and
attribute names that are available within the current scope.
Ctrl+Space is, however, much more than that. It allows you also to quickly add symbol overrides, partial method bodies and partial classes, implement interface members and generate properties. ReSharper will generate and insert the whole body of method, constructor, property etc. when completing such items.
Smart Code Completion, invoked with Ctrl+Alt+Space, filters the list of methods, fields or variables to match the expected type of an expression.
For example, when you
use Smart Completion for method call arguments, the list of suggested values is narrowed
down only to the
required parameter type. Smart Completion can also suggest creating anonymous methods,
lambda expressions, and
regular methods, as well as local variables for out
parameters.
Smart Completion works like a charm in XAML event handlers and other contexts.
Import Symbol Completion is invoked with Shift+Alt+Space. Unlike Symbol Completion (which only completes types accessible at the current location), this command displays all types that match a specified prefix regardless of what namespace they belong to, and automatically adds the appropriate namespace import directives when necessary.
In C# code files, Import Symbol Completion works after dot with extension methods and puts necessary using directives. Import Symbol Completion is also very helpful in XAML markup for tag names. Namespace import directives are also inserted as required.
When the completion list is empty or does not contain expected items, you can always press the shortcut for any completion type the second time.
ReSharper will extend the completion list with protected, private and internal members, symbols from non-referenced assemblies, call chains that have return values of the expected data type, casts to the expected data type, and more. Of course, if you use any of the suggestions the missing imports and references are added automatically.
ReSharper allows you to narrow down completion suggestions by kind of symbol, access modifiers and other filters. You can modify the set of applied filters each time code completion is invoked and/or choose to keep the state of filters.
ReSharper also provides a set of C# typing assistance features that correct subtle mistypes as you enter code.
For example, if you happen to type MethodName(.)
, this will be automatically
replaced with
MethodName().
, allowing you to keep entering a call chain without having to
deal with an invalid syntax error.
Similarly, ReSharper will correct a mistyped @$
prefix to $@
in
verbatim string interpolations.
All keyboard shortcuts provided in this page are available in ReSharper's default "Visual Studio" keymap. For details on ReSharper's two keymaps, see ReSharper Documentation.