Dotnet logo

.NET Tools

Essential productivity kit for .NET and game developers


ReSharper in Detail: Code Completion in ReSharper 4.0

ReSharper extends Visual Studio’s native IntelliSense with a set of three Code Completion features to make it more convenient and adaptable.
ReSharper’s Code Completion is a natural candidate for in-detail review. However, a full-fledged description is out of agenda, because Ilya Ryzhenkov’s Code Completion with ReSharper says it all. Or does it?
While his post is comprehensive, it was written back when R# 3.0 EAP was far from being complete. That said, a number of corrections and additions are due to be announced as of late R# 4.0 EAP.

  • There are still three Completion features, but what was previously known as Basic Completion is now called Symbol Completion, while Type Name Completion was renamed to Import Symbol Completion.
  • In ReSharper 4.0, all three completion features support CamelHumps – for example, you can complete a long type name by entering only its uppercase characters (can you say “DecoderReplacementFallbackBuffer”? forget it – just type DRFB instead)
    To make sure it works, clear the Case-sensitive prefix matching check box in Resharper | Options | Environment | IntelliSense | Completion Behavior. Note that the Use CamelHumps check box in ReSharper | Options | Environment | Editor doesn’t have any impact on how CamelHumps works in completion.
  • Needless to say, Code Completion as of R# 4.0 supports C# 3.0 features, including:
    • Extension methods. Both Smart Completion and Symbol Completion are enabled to suggest extension methods. Import Symbol Completion works after dot for extension methods and inserts required using directives:
    • Object and collection initializers. Smart Completion in initializers displays available properties/fields to initialize:
    • Lambdas. Smart Completion generates lambda-expression syntax as an alternative for anonymous and named methods:
  • Complete Statement. Complete Statement is a feature that inserts necessary syntax elements with a simple shortcut – Ctrl+Shift+Enter. It comes to the rescue in numerous situations, including auto-closing parentheses, adding semicolons, completing if, while and for statements, declaring classes, methods, and structs, and so on:
  • There are also some minor changes and fixes, including completion for boolean fields in XAML files, auto-inserting closing single quotes in XML attributes, and so forth.

Additional references

Technorati tags: ReSharper, ReSharper in Detail, Code Completion, CamelHumps, ReSharper 4.0
image description

Discover more