RubyMine 7.0.0 Web Help

RubyMine enables you to evaluate an arbitrary expression in the context of a stack frame currently selected in the Frames pane of the Debug window. The following modes are available:

  • Expression Mode for evaluating single-line expressions.
  • Code Fragment Mode for evaluating short code portions introducing them in the Statements to evaluate text field. Supported constructs are declarations, assignments, loops andif/else.

Besides that, RubyMine provides a way to quickly evaluate an expression in the editor at caret or a selection.

Warning

While using the Expression Evaluation feature, be aware of the following:

  • A method can be invoked within the Expression Evaluation dialog only if the debugger has stopped at a breakpoint, but has not been paused.
  • Expression Evaluation can be only "single-level". In other words, if RubyMine stops at a breakpoint within a method called from the Expression Evaluation, you cannot use the Expression Evaluation feature again.
To evaluate an arbitrary expression
  1. In the Frames pane, select the thread where you want an expression to be evaluated.
  2. Invoke the Evaluate Expression in one of the following ways:
    • On the main menu, choose Run | Evaluate Expression
    • On the context menu of the editor, choose Evaluate Expression
    • Press Alt+F8Shift+Alt+8Shift+Alt+8Alt+F8Alt+F8Alt+F8Ctrl+F9Ctrl+UAlt+F8Alt F8Alt F8Command UCommand F11
    • Click variables_evaluate_expr on the stepping toolbar of the Debug tool window.
  3. Select the desired mode of evaluation. If you want to evaluate a code fragment, click the Code Fragment Mode button.
  4. Depending on the mode selected, type the expression or statements to evaluate in the text field.

    evaluate_expression

    Tip

    If you have assigned a label to a variable, object, or watch, you can reference it by this label as if it were a local variable <label-name>_DebugLabel defined in the same context where the expression is evaluated. RubyMine also displays this label in the completion suggestion list.

  5. Click Evaluate. If the specified expression cannot be evaluated, the possible reason will be briefly described in the Result pane of the dialog box.

    evaluate_expression_impossible

Tip

During the debugger session, the value of any expression at caret is shown at the tooltip every time you hover your mouse pointer over it. If an expression contains children, clicking add expands the node and displays all children.

However, Quick evaluate expression helps you view the expression value using the keyboard only.

To quickly evaluate an expression in the editor

There are two ways to quickly evaluate an expression:

  • 7.0+ By using the Show Value On Selection Change functionality:
    1. In the Debug tool window toolbar click the Settings icon projectToolWindowSettingsIcon and select the Show Value On Selection Change option from the popup menu.
    2. Select a code fragment with the mouse, or by clicking Ctrl+W. A tooltip with the expression value automatically appears under the selection and changes each time you change the selection:

      evaluate_selection

  • By manually invoking the tooltip with the expression value:
    1. Place the caret at the desired location, or select an expression to be evaluated.
    2. Press Ctrl+Alt+F8Ctrl+Alt+8 or Ctrl+Shift+Alt+Button1 ClickCtrl+Alt+8 or Ctrl+Shift+Alt+Button1 ClickCtrl+Alt+8 or Ctrl+Shift+Alt+Button1 ClickCtrl+Alt+F8Shift+F9Ctrl+Alt+F8Ctrl+Alt+F8Alt+Meta+F8Alt Command F8Alt Command F8Alt Command F8Alt Button1 Click or Alt Command F11. The tooltip with the expression value appears under the selected expression.

      py_quickEvaluateExpression

See Also

Procedures:

Reference:

Web Resources: