RubyMine 2017.3 Help

Ruby Code Insight

Basics

Code insight is a common name used for auto-completion, intention actions, type inference, and just all the things related to the code analysis in RubyMine.

Here we speak about the Ruby code insight only, as the sections about code completion or navigation relate to the all the languages supported in RubyMine.

Examples

Syntax highlighting

The RubyMine editor respects highlighting of the keywords, comments, parameters, etc. The particular highlighting colors are defined in the Editor | Color Scheme page of the Settings/Preferences dialog.

Code completion

RubyMine supports Code completion.

As RubyMine indexes your whole project on each startup, it allows you to autocomplete any existing entity wherever it is defined.

In particular, the types of constructor's parameters are suggested, and as a consequence the fields of a class are also involved:

rm completion for class field
Inline hints for parameters

For the function/method calls, the hints for parameters are shown:

rm parameter hints

Similar hints show arguments grouping if they are passed to a vararg parameter like *args or **options:

rm parameter hints 1
Navigating to declaration

RubyMine allows you to navigate to a location where a particular named code reference has been first declared.

This is done most easily: just put the caret at the symbol in question in the editor and press Ctrl+B:

ruby viewDeclaration

Refer to the Navigating to Declaration or Type Declaration of a Symbol section for details, and the entire Navigating Through the Source Code section to learn about the other types of navigation.

Checking regular expressions

If your code contains a regular expression, there is an intention action to check it: just put the caret at the regular expression in question and press Alt+Enter. The RegExp checker shows up, and you have to type the string. If your string doesn't match, the background is red; if it does - green:

ruby check regexp1

Read this section for details.

RuboCop support

Since RubyMine version 2017.3, you are not only able to fix the whole file with RuboCop, but even choose whether you want to correct all possible offenses, a specific cop department, or even a particular offense type.

To do that, press Alt+Enter:

rubocop intentions

See RuboCop section.

Notifications

To help the users never forget about routine tasks, RubyMine provides special notifications, for example:

Viewing reference documentation

With RubyMine, you don’t need to surf the web every time you stumble across some alias, or search your whole application for a method declaration you can’t remember. Just put the caret on a keyword you want to look up, and hit Ctrl+Q:

ruby quickDefinitionLookupURL

See Viewing Inline Documentation for details.

Last modified: 4 April 2018