void (@NotNull PsiElement atCaret, @NotNull OrderedSet<PsiElement> res, boolean recurse) { res.add(0, atCaret); if (doNotStepInto(atCaret)) { if (!recurse) return; recurse = false; } PsiElement parent = atCaret.getParent(); if (atCaret instanceof GrClosableBlock && parent instanceof GrStringInjection && parent.getParent() instanceof GrString) { res.add(parent.getParent()); } if (parent instanceof GrArgumentList) { res.add(parent.getParent()); } //if (parent instanceof GrWhileStatement) { // res.add(parent); //} final PsiElement[] children = getChildren(atCaret); for (PsiElement child : children) { collectAllElements(child, res, recurse); } }