@Nullable @Override public Spacing getSpacing(@Nullable Block child1, @NotNull Block child2) { return mySpacingBuilder.getSpacing(this, child1, child2); }
/** * Returns a spacing object indicating what spaces and/or line breaks are added between two * specified children of this block. * * @param child1 the first child for which spacing is requested; * {@code null} if given {@code 'child2'} block is the first document block * @param child2 the second child for which spacing is requested. * @return the spacing instance, or null if no special spacing is required. If null is returned, * the formatter does not insert or delete spaces between the child blocks, but may insert * a line break if the line wraps at the position between the child blocks. * @see Spacing#createSpacing(int, int, int, boolean, int) * @see Spacing#getReadOnlySpacing() */ @Nullable @Override public Spacing getSpacing(@Nullable Block child1, @NotNull Block child2) { return spacingBuilder.getSpacing(this, child1, child2); }
/** * Returns a spacing object indicating what spaces and/or line breaks are added between two * specified children of this block. * * @param child1 the first child for which spacing is requested; * {@code null} if given {@code 'child2'} block is the first document block * @param child2 the second child for which spacing is requested. * @return the spacing instance, or null if no special spacing is required. If null is returned, * the formatter does not insert or delete spaces between the child blocks, but may insert * a line break if the line wraps at the position between the child blocks. * @see Spacing#createSpacing(int, int, int, boolean, int) * @see Spacing#getReadOnlySpacing() */ @Nullable @Override public Spacing getSpacing(@Nullable com.intellij.formatting.Block child1, @NotNull com.intellij.formatting.Block child2) { return spacingBuilder.getSpacing(this, child1, child2); }
spacing = spacingBuilder.getSpacing(this, child1, child2);
return mySpacingBuilder.getSpacing(this, child1, child2);
@Nullable @Override public Spacing getSpacing(@Nullable Block child1, @NotNull Block child2) { return mySpacingBuilder.getSpacing(this, child1, child2); }
@Nullable @Override public Spacing getSpacing(@Nullable final Block child1, @NotNull final Block child2) { return spacingBuilder.getSpacing(this, child1, child2); }
@Nullable @Override public Spacing getSpacing(@Nullable Block child1, @NotNull Block child2) { //todo Add more complex logic on spacing, if needed return spacingBuilder.getSpacing(this, child1, child2); }
@Nullable @Override public Spacing getSpacing(@Nullable Block child1, @NotNull Block child2) { Spacing spacing = spacingBuilder.getSpacing(this, child1, child2); if (spacing == null) { return SPACE; } return spacing; }
@Nullable @Override public Spacing getSpacing(@Nullable Block child1, @NotNull Block child2) { Spacing result = null; if (child1 instanceof TemplateToolkitFormattingBlock && child2 instanceof TemplateToolkitFormattingBlock) { result = mySpacingBuilder.getSpacing(this, child1, child2); } if (result != null) { return result; } return super.getSpacing(child1, child2); }
@Nullable @Override public Spacing getSpacing(@Nullable Block child1, @NotNull Block child2) { Spacing spacing = null; if (child1 != null && !(child1 instanceof CsvDummyBlock) && !(child2 instanceof CsvDummyBlock)) { CsvBlockElement block1 = (CsvBlockElement) child1; CsvBlockElement block2 = (CsvBlockElement) child2; if (myFormattingInfo.getCsvCodeStyleSettings().TABULARIZE && isTabularizeSpacingRequired(block1, block2)) { int spaces = block2.getColumnInfo().getMaxLength() - block2.getField().getTextLength() + getAdditionalSpaces(block1, block2); spacing = Spacing.createSpacing(spaces, spaces, 0, true, 0); } else { spacing = myFormattingInfo.getSpacingBuilder().getSpacing(this, child1, child2); } } return spacing; }
@Nullable @Override public Spacing getSpacing(@Nullable Block child1, @NotNull Block child2) { if (!myFormattingInfo.getCsvCodeStyleSettings().TABULARIZE || myFormattingInfo.getCsvCodeStyleSettings().WHITE_SPACES_OUTSIDE_QUOTES || child1 == null) { return null; } int spaces = 0; CsvBlockElement block1 = (CsvBlockElement) child1; CsvBlockElement block2 = (CsvBlockElement) child2; if ((block1.getElementType() == CsvTypes.QUOTE && myFormattingInfo.getCsvCodeStyleSettings().LEADING_WHITE_SPACES) || (block2.getElementType() == CsvTypes.QUOTE && !myFormattingInfo.getCsvCodeStyleSettings().LEADING_WHITE_SPACES)) { spaces = getColumnInfo().getMaxLength() - getTextLength(); } else { return myFormattingInfo.getSpacingBuilder().getSpacing(this, child1, child2); } return Spacing.createSpacing(spaces, spaces, 0, true, 0); }
return getSpacingBuilder().getSpacing(parent, child1, child2);