private @NotNull FormattingModel buildModel(@NotNull FormattingModelBuilder builder,
                                              @NotNull PsiFile file,
                                              @NotNull TextRange range,
                                              @Nullable Document document) {
    FormattingModel model = CoreFormatterUtil.buildModel(builder, file, range, mySettings, myMode);
    if (document != null && useDocumentBaseFormattingModel()) {
      model = new DocumentBasedFormattingModel(model, document, myCodeStyleManager.getProject(), mySettings,
                                               file.getFileType(), file);
    }
    return model;
  }
private @NotNull FormattingModel buildModel(@NotNull FormattingModelBuilder builder,
                                              @NotNull PsiFile file,
                                              @NotNull TextRange range,
                                              @Nullable Document document)