String (@NotNull PsiElement injectedNode) { String leafText = InjectedLanguageUtilBase.getUnescapedLeafText(injectedNode, false); if (leafText != null) { return leafText; // optimization } StringBuilder text = new StringBuilder(injectedNode.getTextLength()); // gather text from (patched) leaves injectedNode.accept(new PsiRecursiveElementWalkingVisitor() { @Override public void visitElement(@NotNull PsiElement element) { String leafText = InjectedLanguageUtilBase.getUnescapedLeafText(element, false); if (leafText != null) { text.append(leafText); return; } super.visitElement(element); } }); return text.toString(); }