private static @Nullable Document createPsiDocument(@Nullable Project project,
                                                      @NotNull String content,
                                                      @Nullable FileType fileType,
                                                      @NotNull @NonNls @SystemIndependent String lightFilePath,
                                                      boolean readOnly) {
    if (project == null || project.isDefault()) return null;
    if (fileType != null && fileType.isBinary()) return null;

    LightVirtualFile file = new MyLightVirtualFile(lightFilePath, fileType, content);
    file.setWritable(!readOnly);

    return ReadAction.compute(() -> {
      Document document = FileDocumentManager.getInstance().getDocument(file, project);
      if (document == null) {
        return null;
      }
      PsiDocumentManager.getInstance(project).getPsiFile(document);
      return document;
    });
  }
private static @Nullable Document createPsiDocument(@Nullable Project project,
                                                      @NotNull String content,
                                                      @Nullable FileType fileType,
                                                      @NotNull @NonNls @SystemIndependent String lightFilePath,
                                                      boolean readOnly)