Rider for Unreal Engine tips and tricks

Posted on May 19, 2021

Quick project files navigation

Use ALT + 1 shortcut to focus/toggle Solution Explorer and quickly navigate between directories using arrow keys.

Code generation

Use ALT + Insert shortcut to automatically generate code for overridden functions, constructors, getters and setters.

Vertical and horizontal split

If you like to work in full-screen mode and hate the fact that you can only split your tabs using the right mouse button and selecting either “Split Right” or “Split Down” worry no more. Open Settings, go to Keymap and search for “Split Right”. Select the Window/Editor Tabs/Split Right action and assign a shortcut of your choice (I use CTRL + ALT + SHIFT + \). Follow above instructions for Split Down action.

Move tab to opposite tab

If you use the vertical and horizontal split feature it is common to juggle the tab between one group and the other. Unfortunately, there is no default shortcut for doing that. Open Settings, go to Keymap and search for the “Move To Opposite Group” action. Select Other/Tabs/Move To Opposite Group and assign a shortcut of your choice (I use ALT + \).

Preview function signature

If you are annoyed by disappearing function signature while you type in parameters and you can’t remember parameter types or order here is something for you. You can use CTRL + P to preview current matching function signature as well as select next matching signature if one exist by pressing CTRL + P second time.

clang-format

I loved the fact that Visual Studio detects .clang-format file in a project directory by default and use it for formatting settings and default “Format Selection” and “Format Document”. It even ships with LLVM binaries so you don’t even have to download anything. However, Rider doesn’t do any of that. Fortunately, there is a plugin that can expose some basic functionality.

Open Settings, go to Plugins and search for ClangFormatIJ and install it. If you already have your LLVM toolset installed and added to the PATH variable you don’t need to do anything else. If you don’t you can download the installer here. You can verify if clang-format is working properly by opening an arbitrary source file, selecting a snippet of code, pressing a right mouse button and selecting “Reformat Current Selection with clang-format”. If this command failed to run you should see an error in the lower right corner of the screen. Go to Settings, Tools, clang-format and adjust properties values to match your machine setup.

To bind clang-format related actions go to Settings, Keymap and search for clang-format. Assign shortcuts to Plugins\ClangFormatIJ\Reformat Current Statement with clang-format and Plugins\ClangFormatIJ\Reformat File with clang-format (I use ALT + R and CTRL + SHIFT + ALT + S respectively).

Live templates

Rider comes with a bunch of code templates built it like ctor for creating default class constructor, switch for generating switch statement etc. It is possible to add custom templates for your use. You can take advantage of some of the built-in variables like current date etc. Open Settings, Editor, Live Templates and select the language of your choice (C++). You can find all existing templates there as well as the button to create a new template. For example, if you would like to add a todo template with the following format:

// DD-MM-YYYY TODO: Description

you can do so by defining the following template definition:

// $date$ TODO: $description$

Once that’s in press the “Edit variables” button. Select date variable, untick “Editable” checkbox. Press the “Change macro” button and find “Current date in specified format”. Select it and press the “OK” button. In the text field that appeared below the “Change macro” button type dd-MM-yyyy (note that it is case sensitive). Press the “Done” button. Save the settings. Now type todo anywhere in your source code and press the tab to generate the template.