How-To's

Code completion improvements in Rider 2018.2 EAP

In our latest Rider 2018.2 EAP (Early Access Preview) build, we made a number of improvements to code completion. The scoring engine from R# is now being used, resulting in better code suggestions. We’ve added code completion for scratch files, debugger watches, and C# Interactive. If you are working with unsafe code, we will replace . with the required -> member access operator. And of course we made some bugfixes, too. Let’s have a look!

Better code suggestion scoring

Starting with the Rider 2018.2 EAP, we are using the ReSharper statistics-based scoring algorithm to provide code completion. One of the key aspects is that Rider now keeps track of how many times a given code suggestion was used. The more a suggestion is used, the more likely it will show up in code completion.

In the following example, we’ve used Console.WriteLine() a number of times. Code completion will start suggesting this as the first entry on the Console type:

Better code completion in Rider 2018.2

For many cases, this will provide better code completion than before.

Code completion for scratch files, debugger watches and C# Interactive

We’ve added code completion to several places where it would be handy to get some help from Rider: scratch files, debugger watches and C# Interactive.

Code completion in debugger watches

Just like when writing code in a regular C# or VB.NET file, Rider provides code completion as well as method info and parameter hint popups.

Unsafe member access operator completion

C# does not allow us to use pointer arithmetic by default, to ensure type safety and security in our code base. However, we can use the unsafe keyword to define an unsafe context where this is possible. In such unsafe context, we can work with pointers, much as we can in unmanaged languages.

To access a pointer type’s members, the -> operator must be used instead of the . we’re used to from regular C# code. To help our mind while writing unsafe code, Rider will detect when we use the wrong operator and when completing code, use the correct one:

Rider unsafe member access operator code completion

Bugfixes

Several bugs and corner cases were fixed. Code completion is now available in hot spots, e.g. while using live templates. We fixed some odd code suggestions, for example when working with #region directives.

Download Rider 2018.2 EAP now! We’d love to hear your feedback on these improvements!

image description