void (SuspendContextImpl context) { SourcePosition position = context.getDebugProcess().getPositionManager().getSourcePosition(context.getLocation()); JavaSourcePositionHighlighter highlighter = new JavaSourcePositionHighlighter(); TextRange range = ReadAction.compute(() -> highlighter.getHighlightRange(position)); String actualText = range == null ? null : range.substring(position.getFile().getText()); if (actualText != null) { systemPrintln("Highlight code range: '" + StringUtil.escapeLineBreak(actualText) + "'"); } else { systemPrintln("Highlight whole line"); } }