use of com.intellij.formatting.Alignment in project intellij-community by JetBrains.
the class ChildrenBlocksBuilder method buildNodeChildBlocks.
public List<Block> buildNodeChildBlocks(ASTNode node, BlockFactory factory) {
List<Block> blocks = ContainerUtil.newArrayList();
for (ASTNode child : node.getChildren(null)) {
if (FormatterUtil.isWhitespaceOrEmpty(child) || child.getTextLength() == 0) {
continue;
}
Alignment alignment = myConfig.getAlignment(child);
IElementType type = child.getElementType();
Indent indent = myConfig.getIndent(type);
Wrap wrap = myConfig.getWrap(type);
blocks.add(factory.createBlock(child, indent, alignment, wrap));
}
return blocks;
}
use of com.intellij.formatting.Alignment in project intellij-community by JetBrains.
the class AlignmentProvider method getAlignment.
@Nullable
public Alignment getAlignment(@NotNull PsiElement e) {
final Set<PsiElement> set = myTree.get(e);
if (set == null) {
return null;
}
Alignment alignment = myAlignments.get(set);
if (alignment != null)
return alignment;
Alignment.Anchor anchor = myAnchor.get(set);
if (anchor == null) {
myAnchor.put(set, Alignment.Anchor.LEFT);
anchor = Alignment.Anchor.LEFT;
}
alignment = Alignment.createAlignment(myAllowBackwardShift.get(set), anchor);
myAlignments.put(set, alignment);
return alignment;
}
Aggregations