PsiFile (@NotNull ASTNode thisElement) { FileASTNode node = findFileElement(thisElement); PsiElement psi = node == null ? null : node.getPsi(); if (psi == null || psi instanceof PsiFile) return (PsiFile)psi; throw new AssertionError("Invalid PSI " + psi + " of " + psi.getClass() + " for AST " + node + " of " + node.getClass()); }