public static CodeStyleSettings getSettings(@NotNull Project project, @NotNull Document document) {
    PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(document);
    return file != null ? getSettings(file) : getSettings(project);
  }
public static CodeStyleSettings getSettings(@NotNull Project project, @NotNull Document document)