Code Completion Improvements in ReSharper 9

ReSharper 9.x continues to build on the radical improvements in ReSharper 8 with even more completion features and enhancements to existing ones.

Here’s what we’ve got:

  • Completion filters let you take control of your search results if they get too big. The new completion filters let you fine-tune the set of results by showing a set of options below the completion list. These buttons can be toggled either using the shortcut keys or the mouse (left button adds the element, right button removes it):
    Code completion filters
    The behavior of completion filters is configurable in ReSharper’s options. You can choose whether to enable or disable filters, whether to show the filter bar, and whether filter state should persist between successive invocations. It is also possible to add custom filters which can take care of special circumstances, such as collisions between identically named APIs:
    Custom completion filter configuration
  • Sorting by relevance, which is a ReSharper 9.1 feature, ensures that the set of completion items you are shown have the most relevant items listed first. Also, selection no longer jumps between items while populating the completion list.
  • Fuzzy matching ensures that, even if you make a mistake in an identifier, code completion results will still show the right item if it looks to be similar. Here’s an example:
    Fuzzy matching in code completion
  • Combo returns are a novel feature useful for situations where you have a method that has to do either a return or a yield return. When using smart completion in a return statement, ReSharper filters the list to only show the types that match the return value:
    Combo returns
    Return completion also detects the use of an enum member that is being returned:
    Enum members in return completion
  • Parameter info now includes ReSharper’s annotations:
    Annotations in Parameter Info
    This new behavior is configurable: you can elect to show all annotations, only NotNull/CanBeNull, or hide them altogether. You can also now limit the number of signatures that are shown in the Parameter Info list:
    Parameter Info configuration
  • Double completion improvements (read this for more info on double completion) now show potentially overridable methods after override, static members in non-static context, instance members in a static context, sealed types after typing : in a class declaration, abstract types after typing new, and non-partial classes after typing partial class.
  • Smart completion for strings determines situations where a parameter that takes a string actually takes a specific range of values available elsewhere. For example, here is how ReSharper shows smart completion for a WebRequest.Method property:
    Smart completion for strings

Finally, as always, we’ve made performance improvements to the way code completion works. The completion mechanism was partially rewritten so as to make the lookup items lazy, and to ensure that only the items in the current view are rendered. This makes this whole thing faster, just so you know.

Enjoy!

This entry was posted in How-To's and tagged , , . Bookmark the permalink.

10 Responses to Code Completion Improvements in ReSharper 9

  1. LordJZ says:

    Those performance improvements are not nearly enough, unfortunately (RSRP-447853).

    How come you’re still displaying black-and-white popups now that VS 2015 with colored popups has been out for a few months and R# releases already?

    Also funny how it suggests returning GetName() from GetName() method.

    P.S. Yes I continue to shamelessly use the blog comments to promote my bug reports and feature requests 😀

  2. Pingback: The Morning Brew - Chris Alcock » The Morning Brew #1938

  3. Pingback: Dew Drop – October 2, 2015 (#2103) | Morning Dew

  4. Pingback: ReSharper 9, AWS CloudFormation Designer & mehr

  5. The combo returns feel like the answers to the issues i’ve been raising the past couple months (yay)

    The “show the types that match the return value” should definitely prioritize it’s results. Local variables, instance fields, static fields, properties, methods.

    Methods definitely should not be first, recursion is very infrequent. It’s also pretty infrequent to run something other than a data point. In almost all nominal cases a return statement returns a local variable and secondly an instance field.

    It’s pretty uncommon to be returning static fields or properties (why are you returning something that’s already accessible?).

  6. Pingback: Les liens de la semaine – Édition #152 | French Coding

  7. Peter says:

    I wish there was a way to handle code completion similar to XCode. By this I mean, it should show me the most relevant piece in semi-transparent/light gray and allow me to tab my way through completion. Kind of like code completion when using a Linux command line. Of course, it needs to be smart about what it picks by default. Chris’s comment above is a good starting point.

    The vast majority of the time code completion is (too) pop-up happy, which tends to take me out of the flow. I’d say 90+% of the time I don’t need it; I know what I want to type. It would be helpful if it could help me type that, but it shouldn’t get in the way so much. If I press Ctrl+Space then yes, sure, pop-up and give me all the options, but otherwise, just stay quiet in the background.

  8. Maheswar says:

    Resharper 9.2 is very slow.It is consuming whole disk writing, Please help me out.

Leave a Reply

Your email address will not be published. Required fields are marked *