@Override
  public @NotNull FormattingModel createModel(com.intellij.formatting.@NotNull FormattingContext formattingContext) {
    PsiFile containingFile = formattingContext.getContainingFile().getViewProvider().getPsi(GroovyLanguage.INSTANCE);
    assert containingFile != null;
    ASTNode astNode = containingFile.getNode();
    assert astNode != null;
    CodeStyleSettings settings = formattingContext.getCodeStyleSettings();
    CommonCodeStyleSettings groovySettings = settings.getCommonSettings(GroovyLanguage.INSTANCE);
    GroovyCodeStyleSettings customSettings = settings.getCustomSettings(GroovyCodeStyleSettings.class);

    final AlignmentProvider alignments = new AlignmentProvider();
    if (customSettings.USE_FLYING_GEESE_BRACES) {
      formattingContext.getPsiElement().accept(new PsiRecursiveElementVisitor() {
        @Override
        public void visitElement(@NotNull PsiElement element) {
          if (GeeseUtil.isClosureRBrace(element)) {
            GeeseUtil.calculateRBraceAlignment(element, alignments);
          }
          else {
            super.visitElement(element);
          }
        }
      });
    }

    final GroovyBlock block = new GroovyBlock(
      astNode,
      Indent.getAbsoluteNoneIndent(),
      null,
      new FormattingContext(groovySettings, alignments, customSettings, false, false, GroovyBlockProducer.DEFAULT)
    );

    if (Registry.is("groovy.document.based.formatting")) {
      return new DocumentBasedFormattingModel(block, settings, containingFile);
    }
    else {
      return new GroovyFormattingModel(containingFile, block, FormattingDocumentModelImpl.createOn(containingFile));
    }
  }
@Override
  public @NotNull FormattingModel createModel(com.intellij.formatting.@NotNull FormattingContext formattingContext)