Document () { Document document = FileDocumentManager.getInstance().getDocument(virtualFile, project); if (document == null) { Language language = (virtualFile instanceof LightVirtualFile) ? ((LightVirtualFile)virtualFile).getLanguage() : null; throw new AssertionError(String.format("no document for: %s (fileType: %s, language: %s, length: %s, valid: %s)", virtualFile, virtualFile.getFileType(), language, virtualFile.getLength(), virtualFile.isValid())); } return document; }