public static @NotNull FileContent createByText(final @NotNull VirtualFile file, final @NotNull CharSequence contentAsText, @Nullable Project project) {
    FileType fileType = FileTypeRegistry.getInstance().getFileTypeByFile(file);
    FileContentImpl content = new FileContentImpl(file,
                                                  fileType,
                                                  contentAsText,
                                                  () -> {
                                                    throw new IllegalStateException("Content must be converted from 'contentAsText'");
                                                  },
                                                  true);
    if (project != null) {
      content.setProject(project);
    }
    return content;
  }
public static @NotNull FileContent createByText(final @NotNull VirtualFile file, final @NotNull CharSequence contentAsText, @Nullable Project project)