First Steps with JetBrains Rider
This topic will help you quickly get started with JetBrains Rider, and get familiar with its most frequently used features.
Accessing frequently used commands
The toolbar of the Rider main window does not show many commands, but the most indispensable ones are at your fingertips:
Navigating and searching
JetBrains Rider provides a lot of navigation and search features. Let's get familiar with some of them.
Jumping to declaration
Press the Ctrl key and hover the mouse over your code. You will see that all symbols defined elsewhere become underlined when in focus. You can click any symbol while holding down the Ctrl key to navigate directly to its declaration. If the symbol is defined in the current solution, JetBrains Rider opens the corresponding file and brings the caret to the declaration. If the symbol is defined in a compiled library, JetBrains Rider will decompile the declaration for you. For more information, see Go to Declaration.
To navigate in the opposite direction, i.e. to find all places in your solution where the symbol is used, press Shift+F12. JetBrains Rider will quickly find and display all usages of the symbol. For more information, see Finding Usages.
Checking available navigation actions
Another handy navigation shortcut is Alt+`. When you press it on any symbol, JetBrains Rider will show you all available navigation options: For more information, see Navigate To.
Finding anything in your solution
If you need to find anything in your solution, press Ctrl+T. The list of suggestions appears as soon as you invoke this feature and initially includes your recent files and navigated items. You can start typing to find types, symbols, files, recent edits, recent files, and recently viewed methods. For more information, see Search Everywhere.
Locating current file in the solution tree
When a navigation command brings you to a new file, you may want to see where it is in the Solution Explorer. Just press Shift+Alt+L and the Solution Explorer will scroll to the current file and highlight it. For more information, see Locating Current File in Solution Explorer
Coding in the editor
When you are working in the editor, a bunch of code editing helpers are at your hand. Here are a couple of them.
Code completion (IntelliSense)
Rider's IntelliSense works automatically, but you can always invoke JetBrains Rider's code completion features explicitly, either after you have typed something or even instead of typing, wherever any meaningful code is allowed:
- Pressing Ctrl+Alt+Space invokes the smart completion that provides more intelligent suggestions based on the expected type of the expression.
- Pressing Shift+Alt+Space invokes the import symbol completion that displays all types that match a given prefix regardless of what namespace they belong to, It also inserts appropriate namespace import directives to the current file if necessary.
Selecting and moving code blocks
Wherever your caret is, try pressing Ctrl+Alt+Right / Ctrl+Alt+Left. These shortcuts allow you to successively select a symbol, line, or block of code so that you can easily select any desired expression for copying, cutting, or moving. For more information, see Selecting Text in the Editor.
If you need to move the selected code block, press Ctrl+Shift+Alt and then use the arrow keys to move the block to any allowed position. For more information, see Rearranging Code Elements
The power of Alt+Enter
Very often you will see one of many different action indicators in the left part of the editor. You can press Alt+Enter to see what JetBrains Rider has to suggest at the current caret position:
Here are a couple of examples:
- If you see a red bulb or a yellow bulb icon it is even recommended to press Alt+Enter because these action indicators tell you that JetBrains Rider has detected an error or other code issue and it knows how to fix it.
- If you see a hammer icon, you can ignore it unless you want to modify code at the caret. If you want to make changes, pressing Alt+Enter may be helpful. JetBrains Rider provides hundreds of context actions that can, for example, quickly change symbol visibility, add code that iterates over a collection, and more.
- You can also press Alt+Enter if there are no action indicators in view. In this case, you can start typing to quickly find and execute any JetBrains Rider action in scope.
JetBrains Rider's set of refactorings by far surpasses that provided by Visual Studio, with regard to number, usability and scope of application.
It is not easy to learn and remember each of several dozens refactorings that JetBrains Rider provides. However, you can press Ctrl+Shift+R on any symbol in your code and check out which refactorings are available here.
JetBrains Rider can help you concentrate on non-trivial tasks by providing a lot of features for generating boilerplate code automatically. For example, you can call a non-existent method and JetBrains Rider will create this method based on the usage, taking into account the return type and the types of parameters.
Generating type members
When your caret is anywhere within a type declaration, press Alt+Insert. In the pop-up menu that opens, you can select an item that you want to generate for the type. JetBrains Rider can create constructors, properties, overriding members, and more. For more information, see Code Generation.
Code style matters
With JetBrains Rider, you can control the most of style aspects in your code: naming standards, formatting rules, and many other tiny things (such as order of modifiers or whether to use the 'var' keyword).
The default values of JetBrains Rider code style features are selected based on Microsoft guidelines and numerous best practices. At the same time, each tiny aspect of code style can be changed to fit your personal or corporate preferences.
To apply code style rules, press Ctrl+E, C. JetBrains Rider will prompt you to choose one of the two default code cleanup profiles: either reformat the code or apply multiple code style rules in the selected scope.