本文整理了Java中com.intellij.formatting.Alignment
类的一些代码示例,展示了Alignment
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Alignment
类的具体详情如下:
包路径:com.intellij.formatting.Alignment
类名称:Alignment
暂无
代码示例来源:origin: ballerina-platform/ballerina-lang
alignment = myAlignmentMap.get(myNode);
} else {
alignment = Alignment.createAlignment(true, Alignment.Anchor.LEFT);
myAlignmentMap.put(myNode, alignment);
alignment = myAlignmentMap.get(myNode);
} else {
alignment = Alignment.createAlignment(true, Alignment.Anchor.LEFT);
myAlignmentMap.put(myNode, alignment);
alignment = myAlignmentMap.get(myNode);
} else {
alignment = Alignment.createAlignment(true, Alignment.Anchor.LEFT);
myAlignmentMap.put(myNode, alignment);
alignment = myAlignmentMap.get(treeParent);
} else {
alignment = Alignment.createAlignment(true, Alignment.Anchor.LEFT);
myAlignmentMap.put(treeParent, alignment);
alignment = Alignment.createAlignment(true, Alignment.Anchor.LEFT);
myAlignmentMap.put(myNode, alignment);
} else if (childElementType == BallerinaTypes.COLON && parentElementType == BallerinaTypes.TERNARY_EXPRESSION) {
alignment = myAlignmentMap.get(treeParent);
} else {
alignment = Alignment.createAlignment(true, Alignment.Anchor.LEFT);
myAlignmentMap.put(treeParent, alignment);
代码示例来源:origin: KronicDeth/intellij-elixir
childrenAlignment = Alignment.createChildAlignment(parentAlignment);
代码示例来源:origin: KronicDeth/intellij-elixir
@NotNull
private List<com.intellij.formatting.Block> buildTypeOperationChildren(@NotNull ASTNode typeOperation) {
final Alignment[] operandAlignment = {null};
return buildChildren(
typeOperation,
(child, childElementType, blockList) -> {
if (childElementType == ACCESS_EXPRESSION) {
blockList.addAll(buildAccessExpressionChildren(child, operandAlignment[0]));
} else if (childElementType == TYPE_INFIX_OPERATOR) {
blockList.addAll(buildOperatorRuleChildren(child));
if (codeStyleSettings(typeOperation).ALIGN_TYPE_DEFINITION_TO_RIGHT_OF_OPERATOR) {
operandAlignment[0] = Alignment.createAlignment();
}
} else {
blockList.add(buildChild(child, operandAlignment[0]));
}
return blockList;
}
);
}
代码示例来源:origin: KronicDeth/intellij-elixir
@NotNull
private List<com.intellij.formatting.Block> buildAlignedOperandsOperationChildren(
@NotNull ASTNode operation,
@NotNull Predicate<CodeStyleSettings> alignOperands,
@NotNull TokenSet operatorRuleTokenSet) {
Alignment operandAlignment;
if (alignOperands.apply(codeStyleSettings(operation))) {
operandAlignment = Alignment.createAlignment();
} else {
operandAlignment = null;
}
return buildChildren(
operation,
(child, childElementType, blockList) -> {
if (childElementType == ACCESS_EXPRESSION) {
blockList.addAll(buildAccessExpressionChildren(child, operandAlignment));
} else if (operatorRuleTokenSet.contains(childElementType)) {
blockList.addAll(buildOperatorRuleChildren(child, null, null, operandAlignment));
} else {
blockList.add(buildChild(child, operandAlignment));
}
return blockList;
}
);
}
代码示例来源:origin: KronicDeth/intellij-elixir
@NotNull
private List<com.intellij.formatting.Block> buildWhenOperationChildren(@NotNull ASTNode whenOperation) {
Wrap operatorWrap = Wrap.createWrap(WrapType.NORMAL, true);
final Alignment[] operandAlignment = {null};
final Wrap[] operandWrap = {Wrap.createWrap(WrapType.NONE, false)};
return buildChildren(
whenOperation,
(child, childElementType, blockList) -> {
if (childElementType == ACCESS_EXPRESSION) {
blockList.addAll(
buildAccessExpressionChildren(child, operandWrap[0], operandAlignment[0])
);
} else if (OPERATOR_RULE_TOKEN_SET.contains(childElementType)) {
blockList.addAll(buildOperatorRuleChildren(child, operatorWrap));
operandAlignment[0] = Alignment.createAlignment();
operandWrap[0] = Wrap.createChildWrap(operatorWrap, WrapType.NORMAL, true);
} else {
blockList.add(buildChild(child, operandWrap[0], operandAlignment[0]));
}
return blockList;
}
);
}
代码示例来源:origin: KronicDeth/intellij-elixir
Alignment childAlignment = Alignment.createAlignment();
代码示例来源:origin: KronicDeth/intellij-elixir
private List<com.intellij.formatting.Block> buildMultipleAliasesChildren(@NotNull ASTNode multipleAliases) {
Alignment aliasAlignment = Alignment.createAlignment();
代码示例来源:origin: KronicDeth/intellij-elixir
nestedStartAlignment = Alignment.createAlignment();
} else {
nestedStartAlignment = startAlignment;
operandAlignment[0] = Alignment.createAlignment();
operandWrap[0] = Wrap.createWrap(WrapType.NONE, true);
} else {
代码示例来源:origin: KronicDeth/intellij-elixir
@NotNull
@Override
public ChildAttributes getChildAttributes(int newChildIndex) {
ChildAttributes childAttributes;
if (newChildIndex > 0) {
childAttributes = DELEGATE_TO_PREV_CHILD;
} else if (myNode.getElementType() == DO) {
boolean indentRelativeToDirectParent =
codeStyleSettings(myNode).ALIGN_UNMATCHED_CALL_DO_BLOCKS ==
CodeStyleSettings.UnmatchedCallDoBlockAlignment.CALL.value;
Indent indent = Indent.getNormalIndent(indentRelativeToDirectParent);
childAttributes = new ChildAttributes(
indent,
/* all children share the same alignment as expressions inside a doBlock above the stab are assumed
to be aligned on the left-side */
Alignment.createAlignment()
);
} else {
childAttributes = super.getChildAttributes(newChildIndex);
}
return childAttributes;
}
代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin
@NotNull
private List<Block> buildSubBlocks() {
AlignmentStrategy.AlignmentPerTypeStrategy strategy = null;
boolean isStruct = getNode().getElementType() == STRUCT_TYPE;
Alignment forType = null;
if (isStruct) {
strategy = AlignmentStrategy.createAlignmentPerTypeStrategy(ContainerUtil.list(FIELD_DECLARATION, LINE_COMMENT), STRUCT_TYPE, true);
forType = Alignment.createAlignment(true);
}
List<Block> blocks = ContainerUtil.newArrayList();
for (ASTNode child = myNode.getFirstChildNode(); child != null; child = child.getTreeNext()) {
IElementType childType = child.getElementType();
if (child.getTextRange().getLength() == 0) continue;
if (childType == TokenType.WHITE_SPACE) continue;
IElementType substitutor = childType == MULTILINE_COMMENT ? LINE_COMMENT : childType;
Alignment alignment = strategy != null ? strategy.getAlignment(substitutor) : null;
GoFormattingBlock e = buildSubBlock(child, alignment);
if (isStruct) {
e.putUserDataIfAbsent(TYPE_ALIGNMENT_INSIDE_STRUCT, forType);
}
blocks.add(e);
}
return Collections.unmodifiableList(blocks);
}
代码示例来源:origin: KronicDeth/intellij-elixir
child,
stabBodyChildrenWrap,
Alignment.createAlignment(),
childrenIndent
代码示例来源:origin: protostuff/protobuf-jetbrains-plugin
ParentBlock(@NotNull ASTNode node, @Nullable Alignment alignment,
Indent indent, CodeStyleSettings settings) {
super(node, alignment, indent, settings);
childAlignment = Alignment.createAlignment();
}
代码示例来源:origin: Camelcade/Perl5-IDEA
@NotNull
public Alignment getAssignAlignment(@NotNull ASTNode defaultDirectiveNode) {
Alignment result = myAssignAlignmentMap.get(defaultDirectiveNode);
if (result != null) {
return result;
}
result = Alignment.createAlignment(true);
myAssignAlignmentMap.put(defaultDirectiveNode, result);
return result;
}
}
代码示例来源:origin: AlexanderBartash/hybris-integration-intellij-idea-plugin
@Override
public Alignment getAlignment(@NotNull final ASTNode currentNode) {
Validate.notNull(currentNode);
final Alignment alignment;
if (isNewColumn(currentNode)) {
if (columnNumber >= alignments.size()) {
alignment = Alignment.createAlignment(true, Alignment.Anchor.LEFT);
alignments.add(alignment);
} else {
alignment = alignments.get(columnNumber);
}
columnNumber++;
} else {
alignment = Alignment.createAlignment();
}
return alignment;
}
代码示例来源:origin: SeeSharpSoft/intellij-csv-validator
protected CsvBlock(@NotNull ASTNode node, CsvFormattingInfo formattingInfo) {
super(node, Wrap.createWrap(WrapType.NONE, false), Alignment.createAlignment());
this.myFormattingInfo = formattingInfo;
}
代码示例来源:origin: BashSupport/BashSupport
@NotNull
public ChildAttributes getChildAttributes(int newChildIndex) {
return new ChildAttributes(Indent.getNoneIndent(), Alignment.createAlignment());
//return ChildAttributes.DELEGATE_TO_NEXT_CHILD;
}
代码示例来源:origin: Camelcade/Perl5-IDEA
/**
* Returns line-based alignment for the {@code childNode}. Uses previous line alignment from the {@code alignmentsMap}
* or creates a new one.
*
* @param alignmentsMap map for caching line-based values
*/
@Nullable
private Alignment getLineBasedAlignment(@NotNull ASTNode childNode, @NotNull Map<Integer, Alignment> alignmentsMap) {
int nodeLine = getNodeLine(childNode);
if (nodeLine < 0) {
return null;
}
Alignment alignment = alignmentsMap.get(nodeLine);
if (alignment != null) {
return alignment;
}
alignment = alignmentsMap.get(nodeLine - 1);
if (alignment == null) {
alignment = alignmentsMap.get(nodeLine + 1);
}
if (alignment == null) {
alignment = Alignment.createAlignment(true);
}
alignmentsMap.put(nodeLine, alignment);
return alignment;
}
代码示例来源:origin: protostuff/protobuf-jetbrains-plugin
private void appendProtoBlocks(ASTNode protoRootNode, List<Block> blocks) {
ASTNode child = protoRootNode.getFirstChildNode();
Alignment alignment = Alignment.createAlignment();
while (child != null) {
if (!FormatterUtil.containsWhiteSpacesOnly(child)) {
Block block = createBlock(child, alignment, Indent.getNoneIndent(), settings);
blocks.add(block);
}
child = child.getTreeNext();
}
}
代码示例来源:origin: protostuff/protobuf-jetbrains-plugin
@Override
protected List<Block> buildChildren() {
ASTNode child = getNode().getFirstChildNode();
List<Block> result = new ArrayList<>();
while (child != null) {
if (!FormatterUtil.containsWhiteSpacesOnly(child)) {
Block block = BlockFactory.createBlock(child, Alignment.createAlignment(), Indent.getNoneIndent(), settings);
result.add(block);
}
child = child.getTreeNext();
}
return result;
}
代码示例来源:origin: AlexanderBartash/hybris-integration-intellij-idea-plugin
@NotNull
@Override
public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings) {
final Block impexBlock = new ImpexBlock(
element.getNode(),
null,
Alignment.createAlignment(),
createSpaceBuilder(settings),
settings
);
return FormattingModelProvider.createFormattingModelForPsiFile(
element.getContainingFile(),
impexBlock,
settings
);
}
内容来源于网络,如有侵权,请联系作者删除!