@ApiStatus.Internal
  public static @Nullable TrailingSpacesOptions getOptions(@NotNull Document document) {
    if (document.isWritable()) {
      FileDocumentManager fileDocumentManager = FileDocumentManager.getInstance();
      VirtualFile file = fileDocumentManager.getFile(document);
      if (file != null && file.isValid() && !Boolean.TRUE.equals(DISABLE_FOR_FILE_KEY.get(file))) {
        EditorSettingsExternalizable editorSettings = EditorSettingsExternalizable.getInstance();
        if (editorSettings != null) {
          final List<Editor> activeEditors = getActiveEditors(document);
          final Project project = getProject(document, activeEditors);
          MyTrailingSpacesOptions currOptions = new MyTrailingSpacesOptions();
          if (project != null) {
            for (TrailingSpacesOptionsProvider provider : TrailingSpacesOptionsProvider.EP_NAME.getExtensionList()) {
              TrailingSpacesOptionsProvider.Options providerOptions = provider.getOptions(project, file);
              if (providerOptions != null) {
                currOptions.setStripTrailingSpaces(providerOptions.getStripTrailingSpaces());
                currOptions.setEnsureNewLineAtEOF(providerOptions.getEnsureNewLineAtEOF());
                currOptions.setRemoveTrailingBlankLines(providerOptions.getRemoveTrailingBlankLines());
                currOptions.setChangedLinesOnly(providerOptions.getChangedLinesOnly());
                currOptions.setKeepTrailingSpacesOnCaretLine(providerOptions.getKeepTrailingSpacesOnCaretLine());
              }
            }
          }
          return currOptions;
        }
      }
    }
    return null;
  }
@ApiStatus.Internal
  public static @Nullable TrailingSpacesOptions getOptions(@NotNull Document document)