@NotNull
  @Override
  public StripTrailingSpacesFilter createFilter(@Nullable Project project,
                                                @NotNull Document document) {
    if (project == null) return StripTrailingSpacesFilter.ALL_LINES;
    PsiFile file;
    try (AccessToken ignore = SlowOperations.knownIssue("IDEA-307607, EA-765267")) {
      file = PsiDocumentManager.getInstance(project).getPsiFile(document);
    }
    if (file == null) {
      return StripTrailingSpacesFilter.ALL_LINES;
    }
    EditorConfigTrailingSpacesOptionsProvider optionsProvider =
      TrailingSpacesOptionsProvider.EP_NAME.findExtension(EditorConfigTrailingSpacesOptionsProvider.class);
    if (optionsProvider != null) {
      TrailingSpacesOptionsProvider.Options options = optionsProvider.getOptions(project, file.getVirtualFile());
      if (options != null && Boolean.TRUE.equals(options.getStripTrailingSpaces())) {
        return StripTrailingSpacesFilter.ENFORCED_REMOVAL;
      }
    }
    return StripTrailingSpacesFilter.ALL_LINES;
  }
@NotNull
  @Override
  public StripTrailingSpacesFilter createFilter(@Nullable Project project,
                                                @NotNull Document document)