RubyMine 2021.1 Help


RubyMine supports the RBS language to describe the types used in Ruby programs. RubyMine recognizes .rbs files and provides the following coding assistance:

RBS type signatures

RubyMine supports RBS type signatures and uses them to infer the type of Ruby elements. This helps you to experience the better code insight when developing your code in Ruby.

If you have RBS files in your project, RubyMine provides:

  • Better method name completion

    RubyMine displays methods from appropriate classes at the beginning of the list, when invoking code completion.

    Method name completion with RBS
  • Improved navigation actions

    When you invoke the 'Go to declaration' action, RubyMine navigates you to the exact declaration instead of providing a list of declarations to choose from.

    Go to declaration with RBS
  • Search for usages of the corresponding declaration

    With RBS types, RubyMine can find the correct declaration of a Ruby element. When you invoke the 'Find usages' action, RubyMine instantly finds usages of the corresponding declaration instead of giving you a list of declarations to choose from.

    Find usages with RBS
  • Consistent rename refactorings

    RubyMine finds all usages of a particular Ruby element that you are renaming. After invoking the 'Find usages' action, there will be fewer references marked as 'Untyped (potential) usages'.

    Rename refactoring with RBS


If you use earlier versions of Ruby, add the following line to your Gemfile:

gem 'rbs'

The rbs gem provides a set of built-in type signatures for the standard libraries out-of-the-box. When you use rbs in your project, RubyMine displays its sources in external libraries.

Create an RBS file

  1. In the Project view Alt+1, select the directory where you want to create a new RBS file.

  2. Press Alt+Insert and select RBS File/Class from the popup.

    Create a new RBS file

    As another option, select File | New | RBS File/Class from the main menu.

  3. Specify the filename and press Enter.

Configure code style settings

RubyMine applies the same code style settings for both Ruby and RBS. To customize code style settings for RBS:

  1. In the Settings/Preferences dialog Ctrl+Alt+S, go to Editor | Code Style | Ruby.

  2. Configure the desired code style settings.

Configure syntax highlighting

RubyMine uses the Ruby color scheme to highlight the syntax in RBS files.

You can configure RBS-aware syntax highlighting according to your preferences and habits.

  1. In the Settings/Preferences dialog Ctrl+Alt+S, go to Editor | Color Scheme | Ruby.

  2. Select the color scheme, accept the highlighting settings inherited from defaults or customize them as described in Configure colors and fonts.

Last modified: 12 March 2021