public static @NotNull String psiToStringIgnoringNonCode(@NotNull PsiElement element) {
    StringBuilder buffer = new StringBuilder();
    ((TreeElement)element.getNode()).acceptTree(
      new TreeToBuffer(buffer, 0, false, false, false, false, false, false,null) {
        @Override
        protected boolean shouldShowNode(TreeElement node) {
          return super.shouldShowNode(node) &&
                 !(node instanceof PsiErrorElement) && !(node instanceof PsiComment) &&
                 !(node instanceof LeafPsiElement && StringUtil.isEmptyOrSpaces(node.getText())) &&
                 !(node instanceof OuterLanguageElement);
        }

        @Override
        protected boolean showEmptyChildren() {
          return false;
        }
      });
    return buffer.toString();
  }
public static @NotNull String psiToStringIgnoringNonCode(@NotNull PsiElement element)