com.intellij.formatting.FormattingModelProvider Java Examples

The following examples show how to use com.intellij.formatting.FormattingModelProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CsvFormattingModelBuilder.java    From intellij-csv-validator with Apache License 2.0 6 votes vote down vote up
@NotNull
@Override
public FormattingModel createModel(PsiElement element, CodeStyleSettings settings) {
    ASTNode root = CsvFormatHelper.getRoot(element.getNode());
    CsvFormattingInfo formattingInfo = new CsvFormattingInfo(
            settings,
            CsvFormatHelper.createSpaceBuilder(settings),
            CsvFormatHelper.createColumnInfoMap(root, settings)
    );

    return FormattingModelProvider.createFormattingModelForPsiFile(
            element.getContainingFile(),
            new CsvBlock(root, formattingInfo),
            settings
    );
}
 
Example #2
Source File: FormattingModelBuilder.java    From protobuf-jetbrains-plugin with Apache License 2.0 5 votes vote down vote up
@NotNull
@Override
public FormattingModel createModel(PsiElement element, CodeStyleSettings settings) {
    PsiFile containingFile = element.getContainingFile().getViewProvider().getPsi(ProtoLanguage.INSTANCE);
    ASTNode fileNode = containingFile.getNode();
    Wrap wrap = Wrap.createWrap(WrapType.NONE, false);
    Alignment alignment = Alignment.createAlignment();
    ProtoFileBlock block = new ProtoFileBlock(fileNode, wrap, alignment, settings);
    return FormattingModelProvider.createFormattingModelForPsiFile(containingFile, block, settings);
}
 
Example #3
Source File: CypherFormattingModelBuilder.java    From jetbrains-plugin-graph-database-support with Apache License 2.0 5 votes vote down vote up
@NotNull
@Override
public FormattingModel createModel(PsiElement element, CodeStyleSettings settings) {
    CypherBlock block = new CypherBlock(element.getNode(), Alignment.createAlignment(),
            Indent.getNoneIndent(), Wrap.createWrap(WrapType.NONE, false),
            settings,
            CypherFormattingModelBuilder.createSpacingBuilder(settings)
    );
    return FormattingModelProvider.createFormattingModelForPsiFile(element.getContainingFile(), block, settings);
}
 
Example #4
Source File: JSGraphQLEndpointFormattingModelBuilder.java    From js-graphql-intellij-plugin with MIT License 5 votes vote down vote up
@NotNull
@Override
public FormattingModel createModel(PsiElement element, CodeStyleSettings settings) {
    return FormattingModelProvider.createFormattingModelForPsiFile(
            element.getContainingFile(),
            new JSGraphQLEndpointBlock(null, element.getNode(), null, null, createSpaceBuilder(settings)),
            settings);
}
 
Example #5
Source File: BuckFormattingModelBuilder.java    From Buck-IntelliJ-Plugin with Apache License 2.0 5 votes vote down vote up
@NotNull
@Override
public FormattingModel createModel(@NotNull PsiElement element,
                                   @NotNull CodeStyleSettings settings,
                                   @NotNull FormattingMode mode) {
  final BuckBlock block =
      new BuckBlock(null, element.getNode(), settings, null, Indent.getNoneIndent(), null);
  return FormattingModelProvider.createFormattingModelForPsiFile(
      element.getContainingFile(),
      block,
      settings);
}
 
Example #6
Source File: HaxeFormattingModel.java    From intellij-haxe with Apache License 2.0 4 votes vote down vote up
public HaxeFormattingModel(final PsiFile file,
                           CodeStyleSettings settings,
                           final Block rootBlock) {
  myModel = FormattingModelProvider.createFormattingModelForPsiFile(file, rootBlock, settings);
}