Typing Assistance
In addition to saving your time by providing smart suggestions in completion lists, JetBrains Rider provides other typing assistance features, which let you create and edit your code even faster.
Auto-Inserting Matching Delimiters
By default, whenever you type an opening delimiter (
, [
, "
, or '
, a paired character is inserted automatically (whenever appropriate). If you change your mind and press Backspace to delete an opening delimiter, its closing pair is also deleted. If the pairing closing delimiter already exists, JetBrains Rider will not add another one. The matching symbols are inserted according to your formatting preferences.
Regarding braces {}
, JetBrains Rider can provide a closing brace immediately on typing the opening one, or on pressing Enter.
If necessary, you can change the default behavior. To do so, go to the the Braces and Parentheses section.
page of JetBrains Rider settings (Ctrl+Alt+S) and use the controls in theCorrecting Length/Count mistyping
JetBrains Rider prevents you from stumbling over mistyped Length
/Count
properties of arrays/collections. As soon as you erroneously start typing the Count
property for a usage of an array, JetBrains Rider will allow you to pick it from the completion list and replace with the Length
property, which you probably meant to type.
In a similar way, it will help you call the Count
property on a collection usage when you start typing the Length
property by mistake.
The correct property will be there as soon as you accept the completion suggestion:
void Foo(int[] array, List<int> collection)
{
if(array.Length == collection.Count
}
Generating equality and flag checks for enumeration types
When you need to compare a value of enum type to one of the members of this enum, just type a dot and then pick the desired enum member in the completion list:
JetBrains Rider will generate the comparison for you:
public enum Direction
{
North, East, South, West
}
void Turn(Direction whereTo)
{
if(whereTo == Direction.South
}
Creating type parameter from usage in method parameters
When creating generic methods, you can easily add type parameters by typing T
for a new parameter and choosing the corresponding item in the completion list
JetBrains Rider will add a new type parameter to the method declaration and bring you to a position where you can type the name of the type parameter in both its declaration and usage:
After you finish typing the name, press Enter or Tab to go on typing.
Making block comments multiline on Enter
If you write a multiline block comment (/*....*/
), you can type the opening part /*
, then write the first line, and the just hit Enter in the end of the line — JetBrains Rider will insert the closing part */
.
Additionally, JetBrains Rider will insert the asterisk *
in the beginning of each line of a block comment as you press Enter. This behavior is enabled by default, but you can turn it off by clearing the Insert * on Enter after /* check box on the page of JetBrains Rider settings (Ctrl+Alt+S).
Wrapping code blocks with braces and parentheses
With JetBrains Rider, you can select a code block or an expression, then type an opening {
or a closing }
brace to put the selection inside braces, or type an opening (
or a closing )
parenthesis to put the selection inside parentheses. To enable or disable this behavior, use the Surround selection on typing a brace or parenthesis check box on the page of JetBrains Rider settings (Ctrl+Alt+S).