RubyMine 2024.1 Help

Customize views

During a debugging session, RubyMine shows you information about your variables, classes, threads, frames, and more. Moreover, the debugger offers a range of options to customize the display of data according to your project's needs.

By default, RubyMine presents a well-organized and comprehensive view of debugging details in the Debug tool window. This layout provides you with the most commonly used options and actions.

However, you may want to examine some specific details or have the data filtered or rendered in a specific format. In this scenario, RubyMine lets you customize the default layout of the Debug tool window. You have the flexibility to create a powerful and granular configuration, ensuring that your classes are displayed according to your preferences.

Customize data view

RubyMine allows you to configure which information about the variables you want to get.

Unless explicitly specified, these preferences apply to all the places where the variable values are displayed (the Variables tab, inline values view, tooltips, and so on).

Sort variables alphabetically

If required, you can enforce alphabetic ordering for items in the Variables tab.

  1. Press Ctrl+Alt+S to open the IDE settings and then select Settings | Build, Execution, Deployment | Debugger | Data Views.

  2. Select the Sort Variables Alphabetically option.

Configure automatic expression evaluation

The debugger analyzes the statement at the breakpoint and its nearest surrounding statements to find various expressions in the source code, such as myvar.myfield.

If they don't contain explicit method invocations, the debugger evaluates them and shows the corresponding values in the Variables view.

To disable automatic evaluation of expressions:

  1. Press Ctrl+Alt+S to open the IDE settings and then select Settings | Build, Execution, Deployment | Debugger | Data Views.

  2. Clear the Enable auto expressions in Variables view option.

Custom type renderers

RubyMine allows you to provide a completely custom display format for various objects during a debugging session. This can be achieved by using renderers. A renderer is a special setup associated with a particular type that controls how the instances of this type are displayed in the Debug tool window. This setup is based on custom expressions that provide high level of flexibility for displaying the data.

Renderers support all types including primitives and arrays. Also, renderers disregard all access modifiers, so you can access any field irrespective of whether it is encapsulated.

Renderers are particularly useful when you are working with custom collections, whose contents aren't easily readable, and you need to identify their contents at a glance.

Add a renderer

  1. Right-click anywhere in the Variables tab and select Customize data views.

  2. Apply the changes and preview the updates in the Debug tool window and the editor.

  3. On the Ruby Type Renderers tab, click Alt+Insert and configure the newly created renderer as required.

    Add Ruby Type Renderers
  4. Apply the changes and preview the updates in the Variables view.

Renderer properties

Item

Description

Renderer name

The name of the renderer. This name is used for managing renderers and doesn't affect how actual data is displayed.

Apply to objects of class (fully-qualified name)

The object type to which this renderer applies. Enter the fully qualified name of the class.

Use the following expression when rendering an instance

Lets you use the return value of an expression for displaying the object.

Remove a renderer

  1. Right-click anywhere in the Variables tab and select Customize data views.

  2. On the Ruby Type Renderers tab, select the renderer that you are going to remove and click Delete. Then, apply the changes.

Mute renderers

You can temporarily disable renderers without removing them altogether:

  • To mute a single renderer, right-click anywhere in the Variables tab and select Customize data views. On the Ruby Type Renderers tab, clear the box against the renderer you are going to mute and apply the changes.

When required, you can unmute the renderers using the same procedure.

Last modified: 11 February 2024