Improving Productivity with Rider IDE
How much do you need from your IDE to feel comfortable? There are lots of factors affecting this such as technical stack, user interface, extensibility, price, etc. Fortunately, we have enough tools to choose from. Today, I will show how efficient you can be using the proper tools such as Rider IDE JetBrains.
There are several perfect code editors you would rather for some reason. I worked with Microsoft Visual Studio for years and it was a great experience. I also like Visual Studio Code and how easily it can be extended.
There are no tools comparisons here but I will show you why Rider is the best one for me.
Rider is a cross-platform code editor which helps you develop .NET, ASP .NET, .NET Core, Xamarin, or Unity applications on Windows, macOS, or Linux. It contains tons of smart code editing features, navigation and search features, code analysis tools, and much more. You can also extend the feature set by installing suitable plugins for cloud development, Kubernetes, specific framework, etc.
If you are a .NET developer you probably know a Visual Studio plugin ReSharper which provides a huge number of features to have a better coding experience. Here you can find the features comparison between Rider, ReSharper, and Visual Studio.
It is worth mentioning that I use
Visual Studio Keymap. You can configure your preferences by choosing
VSCode, or any other keymap you got used to.
As programmers, we spend most of the time reading and analyzing code. It is important to navigate fast between different app parts, see the dependencies, search for usages. You can always use
Text Search but it is a bit messy. The features below help you to see the whole picture and find any part of the project.
Most of the features described are applicable for the front-end code as well! That fact makes me even happier cause I have had a lot to do with Angular and React in the last couple of years.
The feature name is descriptive enough. Press
Ctr + T or
Shift + Shift and type the name and you will get all associated items in the list below:
Go to Implementation
If you have an interface and searching for the implementations you can press
Ctrl + F12. If there is a list of items - you can choose the suitable one. If there is the only class - you will be navigated instantly.
Find usages is really important when you need to navigate through the project with lots of files. It is way more efficient than searching via text search or in Explorer. You can find usages pressing
Shift + F12 on the object you need.
Personally, I would rather avoid using
TODO in your code. But if you prefer there is an amazing and simple option in the Rider - TODO window. You will also find all
System.NotImplementedException() supposed to be implemented later.
To open the window go to the menu
View -> Tool Windows -> TODO or use a shortcut. It is
Alt + 6 configured for me.
If you want to walk through the file and see its members you had better try Structure Window. It can be opened with the shortcut
Ctrl + Alt + F or menu
View -> Tool Windows -> Structure.
There are three windows to search for the recent locations:
Ctrl + commato see the latest files you have opened
Ctrl + Shift + commato see the latest files you have changed
- `Ctrl + Shift + E' to see the latest locations you have visited.
Alternatively, you can go to the menu
View -> Recent files / Recent Changed Files / Recent Locations.
I don't use them so much mostly because of the integrated Git client which allows me to observe the changes but I found it useful to navigate in the scope.
Errors in Solution Window
Working with the Visual Studio I used to run the Build/Rebuild command when refactoring or new feature implementing to see whether some warnings or errors appear. I don't need to do it with Rider at all because of the
Errors In Solution window.
To open the window go to menu
View -> Tool Windows -> Errors in Solution or press
Ctrl + Alt + 2.
Generate and Refactor Commands
The most useful command in my opinion. You can press
Alt + Enter and see the actions list. Let's create a nested type using all the power Inline Refactorings).
In the beginning, we create a derived type of an existing Interface:
Then we initialize members via the constructor:
Finally, we move implementation into a separate file:
There are way more refactorings provided by the
Alt + Enter combination. You definitely can rely on it while automating the routine codings tasks.
Another powerful command is Refactor this. I am just getting used to it but already find some cases.
You can extract the interface from the class:
Move class to another file:
Rename the object:
There is a
Ctrl + R + Rshortcut that allows you to rename the class (and
*.csfile as well). It will definitely be one of your most popular.
You can also apply this command to any object in the Explorer to Adjust Namespaces, Move to Folder, Rename, etc.
After writing some code sometimes we need to adjust the formatting. There is the Code Cleanup command that makes it incredibly simple. Just press
Ctrl + E + C and see the available options.
In C#, Rider can apply its code formatting and code syntax styles according to StyleCop rules. You can read more details here
For me personally, Services Window is a killer feature. It saves a lot of time for me when debugging, analyzing the output, dealing with containers, etc. There is a configuration guideline you can follow but I'll just show you my common cases.
The feature looks very simple but it combines usage experience in a single place. I don't need some terminals opened or separate UI for the Docker containers or K8S cluster. I can read back-end and front-end logs in the same window. I can easily switch from start to debug mode for specific projects. I would really recommend playing with it.
You can edit, debug, run or analyze your .NET projects via Services Window. It doesn't matter Console Application, Worker Service, ASP .NET Core Web Application, and so on.
If you create the Compound configuration combining multiple applications - you can add it to the list.
Docker and K8S
After setting up the connection just add the
Docker configuration type and get access to Docker Desktop resources.
Switch a context, choose namespaces, observe and modify workloads of the K8S cluster:
For sure, the NPM configuration exists. There are some tasks you can specify:
e2e, etc. You can also configure
I like Python as a scripting tool and fortunately, the Services Window has an option to run the scripts:
Speeding Up Routine
Any time I need to search for a place on the screen and click the mouse makes me thinking about the keyboard shortcut alternative. That's why I am trying to use a keyboard as much as possible.
I have no special recommendations to avoid using a mouse. It is just my experience and feelings. Avoiding mouse makes me more productive and helps keep the context in IDE.
Most Useful Shortcuts
Ctrl + Tor
Shift + Shift(see search everywhere)
Alt + Enter(see inplace refactorings)
Ctrl + F12(see go to implementation)
Shift + F12(see find usages)
Ctrl + E + C(see code cleanup)
Alt + Leftand
Alt + Right- go to next/previous tab
Ctrl + Shift + S- open Rider settings
Ctrl + M + Oand
Ctrl + M + X- collapse/expand class methods
Alt + Upand
Alt + Down- go to next/previous class member
Alt + Insert- create new item
Ctrl + Alt + Lor
Alt + 1- show/hide explorer
Ctrl + Alt + 1- show/hide terminal
Ctrl + Alt + K(git commit) and
Ctrl + Shift + K(git push)
In addition to existing shortcuts, I configured the custom ones to cover repeated cases. To set up keys go to
Settings -> Keymap and choose the action.
Alt + F(git fetch) and
Alt + P(git pull)
Alt + C(close all tabs) and
Alt + A(close other tabs)
Alt + S- show/hide Services Window
There is a perfect feature called CamelHumps that identifies parts of compound names according to CamelCase:
Working with Rider I can delegate code writing and refactoring tasks to IDE and concentrate more on the architecture and the feature design. I believe the environment you prefer exposes a ton of amazing opportunities to make you even more productive and creative. Investigate your tools, search for useful plugins and share your experience!
I hope you find it useful. Thanks for reading!