On this page:
- Evaluating Expressions or Code Fragments in a Stack Frame
- Evaluating Arbitrary Expressions
- Evaluating Expressions in the Editor
In addition to regular expressions, you can also evaluate operator expressions, lambda expressions, and anonymous classes.
The following evaluation modes are available:
- Expression Mode for evaluating single-line expressions.
- Code Fragment Mode for evaluating short code portions. You can evaluate declarations,
assignments, loops and
Besides, RubyMine provides a way to quickly evaluate an expression in the editor at caret or a selection.
- 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 only be "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.
Evaluating Expressions or Code Fragments in a Stack Frame
To evaluate an expression or a code fragment in a stack frame, do the following:
- In the Frames pane, select the thread where you want an expression to be evaluated.
- Invoke the Evaluate Expression command in one of the following ways:
- Select an evaluation mode. If you want to evaluate a code fragment, click the Code Fragment Mode button.
- Depending on the selected mode, type the expression or statements to evaluate in the text field and click Evaluate.
Evaluating Arbitrary Expressions
- Open the Evaluate Expression dialog box in one of the following ways:
- In the
dialog box, specify the expression you want to evaluate. Do one of the following:
- In the Expression field, type the expression in question or choose one of the previously evaluated expressions from the drop-down list.
- To evaluate a code fragment, click the Code Fragment Mode button and fill in the Code Fragment text box.
- Click the Evaluate button. The Result read-only field shows the evaluation output. If the specified expression cannot be evaluated, the Result field explains the reason.
Evaluating Expressions in the Editor
During a debugger session, the value of any expression is shown in the tooltip every time you hover your mouse pointer over it. If an expression contains children, clicking expands the node and displays all children.
There are two ways to evaluate an expression quickly:
By using the Show value tooltip on code selection functionality:
- In the Debugger | Data Views settings page, enable the Show value tooltip on code selection option.
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:
- By manually invoking the tooltip with the expression value: