void (@NotNull XDebugSession xSession) { XDebugProcess process = xSession.getDebugProcess(); if (process instanceof JavaDebugProcess) { DebuggerContextImpl debuggerContext = ((JavaDebugProcess)process).getDebuggerSession().getContextManager().getContext(); DebuggerSession session = debuggerContext.getDebuggerSession(); SourcePosition position = debuggerContext.getSourcePosition(); if (position != null && session != null) { PsiElement element = position.getElementAt(); PsiElement block = PsiTreeUtil.getParentOfType(element, PsiCodeBlock.class, PsiLambdaExpression.class); if (block instanceof PsiCodeBlock) { PsiElement parent = block.getParent(); if (!(parent instanceof PsiMethod) && !(parent instanceof PsiLambdaExpression)) { TextRange textRange = block.getTextRange(); Document document = FileDocumentManager.getInstance().getDocument(position.getFile().getVirtualFile()); if (document != null) { int startLine = document.getLineNumber(textRange.getStartOffset()); int endLine = document.getLineNumber(textRange.getEndOffset()); session.sessionResumed(); session.stepOver(false, new BlockFilter(startLine, endLine), StepRequest.STEP_LINE); return; } } } } } xSession.stepOut(); }