PsiFile () { if (myTransientContent) { Document document = FileDocumentManager.getInstance().getCachedDocument(getFile()); if (document != null) { PsiDocumentManager psiDocumentManager = PsiDocumentManager.getInstance(getProject()); if (psiDocumentManager.isUncommited(document)) { PsiFile existingPsi = psiDocumentManager.getPsiFile(document); if (existingPsi != null) { return checkPsiProjectConsistency(existingPsi); } } } } PsiFile explicitPsi = getUserData(IndexingDataKeys.PSI_FILE); if (explicitPsi != null) { return checkPsiProjectConsistency(explicitPsi); } PsiFile cachedPsi = getUserData(CACHED_PSI); if (cachedPsi != null) { return checkPsiProjectConsistency(cachedPsi); } PsiFile createdPsi = createFileFromText(getContentAsText()); createdPsi.putUserData(IndexingDataKeys.VIRTUAL_FILE, getFile()); putUserData(CACHED_PSI, createdPsi); return checkPsiProjectConsistency(createdPsi); }