public HaxeFormattingModel( final PsiFile file, CodeStyleSettings settings, final Block rootBlock) { myModel = FormattingModelProvider.createFormattingModelForPsiFile(file, rootBlock, settings); shiftIndentInsideRangeInvoker = new ApiInvoker<TextRange>( myModel, "shiftIndentInsideRange", IdeaTarget.IS_VERSION_14_1_5_COMPATIBLE ? new Class<?>[] {ASTNode.class, TextRange.class, int.class} : new Class<?>[] {TextRange.class, int.class}); }
@NotNull @Override public FormattingModel createModel( @NotNull PsiElement element, @NotNull CodeStyleSettings settings, @NotNull FormattingMode mode) { if (DUMP_FORMATTING_AST) { ASTNode fileNode = element.getContainingFile().getNode(); System.out.println("AST tree for " + element.getContainingFile().getName() + ":"); printAST(fileNode, 0); } final PyBlockContext context = new PyBlockContext(settings, createSpacingBuilder(settings), mode); final PyBlock block = new PyBlock(null, element.getNode(), null, Indent.getNoneIndent(), null, context); if (DUMP_FORMATTING_AST) { FormattingModelDumper.dumpFormattingModel(block, 2, System.out); } return FormattingModelProvider.createFormattingModelForPsiFile( element.getContainingFile(), block, settings); }