mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-141082 Smart step into several lambdas - tests
This commit is contained in:
@@ -269,11 +269,6 @@ public class PositionManagerImpl implements PositionManager, MultiRequestPositio
|
||||
}
|
||||
while(true);
|
||||
final List<PsiLambdaExpression> lambdas = new ArrayList<PsiLambdaExpression>(3);
|
||||
// add initial lambda if we're inside already
|
||||
NavigatablePsiElement method = PsiTreeUtil.getParentOfType(element, PsiMethod.class, PsiLambdaExpression.class);
|
||||
if (method instanceof PsiLambdaExpression) {
|
||||
lambdas.add((PsiLambdaExpression)method);
|
||||
}
|
||||
final PsiElementVisitor lambdaCollector = new JavaRecursiveElementVisitor() {
|
||||
@Override
|
||||
public void visitLambdaExpression(PsiLambdaExpression expression) {
|
||||
@@ -282,6 +277,11 @@ public class PositionManagerImpl implements PositionManager, MultiRequestPositio
|
||||
}
|
||||
};
|
||||
element.accept(lambdaCollector);
|
||||
// add initial lambda if we're inside already
|
||||
NavigatablePsiElement method = PsiTreeUtil.getParentOfType(element, PsiMethod.class, PsiLambdaExpression.class);
|
||||
if (method instanceof PsiLambdaExpression) {
|
||||
lambdas.add((PsiLambdaExpression)method);
|
||||
}
|
||||
for (PsiElement sibling = getNextElement(element); sibling != null; sibling = getNextElement(sibling)) {
|
||||
if (!lineRange.intersects(sibling.getTextRange())) {
|
||||
break;
|
||||
|
||||
@@ -187,6 +187,33 @@ public abstract class ExecutionWithDebuggerToolsTestCase extends ExecutionTestCa
|
||||
});
|
||||
}
|
||||
|
||||
protected void printContextWithText(final StackFrameContext context) {
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (context.getFrameProxy() != null) {
|
||||
SourcePosition sourcePosition = PositionUtil.getSourcePosition(context);
|
||||
int offset = sourcePosition.getOffset();
|
||||
Document document = PsiDocumentManager.getInstance(myProject).getDocument(sourcePosition.getFile());
|
||||
CharSequence text = document.getImmutableCharSequence();
|
||||
String positionText = "";
|
||||
if (offset > -1) {
|
||||
positionText = StringUtil.escapeLineBreak(" [" + text.subSequence(Math.max(0, offset - 20), offset) + "<*>"
|
||||
+ text.subSequence(offset, Math.min(offset + 20, text.length())) + "]");
|
||||
}
|
||||
|
||||
println(sourcePosition.getFile().getVirtualFile().getName()
|
||||
+ ":" + sourcePosition.getLine()
|
||||
+ positionText,
|
||||
ProcessOutputTypes.SYSTEM);
|
||||
}
|
||||
else {
|
||||
println("Context thread is null", ProcessOutputTypes.SYSTEM);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void invokeRatherLater(SuspendContextImpl context, final Runnable runnable) {
|
||||
invokeRatherLater(new SuspendContextCommandImpl(context) {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user