public static void setEditorCodeStyle(@Nullable Project project, @NotNull EditorEx editor, @Nullable DocumentContent content) {
    if (project != null && content != null && editor.getVirtualFile() == null) {
      PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(content.getDocument());
      CommonCodeStyleSettings.IndentOptions indentOptions = psiFile != null
                                                            ? CodeStyle.getSettings(psiFile).getIndentOptionsByFile(psiFile)
                                                            : CodeStyle.getSettings(project).getIndentOptions(content.getContentType());
      editor.getSettings().setTabSize(indentOptions.TAB_SIZE);
      editor.getSettings().setUseTabCharacter(indentOptions.USE_TAB_CHARACTER);
    }

    Language language = content != null ? content.getUserData(DiffUserDataKeys.LANGUAGE) : null;
    if (language != null) {
      editor.getSettings().setLanguageSupplier(() -> language);
    }
    else if (editor.getProject() != null) {
      editor.getSettings().setLanguageSupplier(() -> TextEditorImpl.Companion.getDocumentLanguage(editor));
    }

    editor.getSettings().setCaretRowShown(false);
    editor.reinitSettings();
  }
public static void setEditorCodeStyle(@Nullable Project project, @NotNull EditorEx editor, @Nullable DocumentContent content)