mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java formatter : fix review issues : IDEA-CR-37492
This commit is contained in:
@@ -100,12 +100,8 @@ public class JavaCodeStyleSettings extends CustomCodeStyleSettings implements Im
|
||||
|
||||
public boolean SPACES_WITHIN_ANGLE_BRACKETS;
|
||||
|
||||
|
||||
|
||||
public boolean PLACE_DOT_ON_NEXT_LINE = true;
|
||||
|
||||
|
||||
|
||||
//Type arguments
|
||||
public boolean SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENT;
|
||||
|
||||
|
||||
@@ -60,19 +60,21 @@ public class CallChunkBlockBuilder {
|
||||
}
|
||||
|
||||
// Support for groovy style dot placement
|
||||
final ASTNode lastNode = subNodes.get(subNodes.size() - 1);
|
||||
if (lastNode.getElementType() == JavaTokenType.DOT) {
|
||||
AlignmentStrategy strategy = AlignmentStrategy.getNullStrategy();
|
||||
subNodes.remove(subNodes.size() - 1);
|
||||
if (!subNodes.isEmpty()) {
|
||||
subBlocks.add(create(subNodes, wrap, null));
|
||||
if (!subNodes.isEmpty()) {
|
||||
final ASTNode lastNode = subNodes.get(subNodes.size() - 1);
|
||||
if (lastNode.getElementType() == JavaTokenType.DOT) {
|
||||
AlignmentStrategy strategy = AlignmentStrategy.getNullStrategy();
|
||||
subNodes.remove(subNodes.size() - 1);
|
||||
if (!subNodes.isEmpty()) {
|
||||
subBlocks.add(create(subNodes, wrap, null));
|
||||
}
|
||||
Block block =
|
||||
newJavaBlock(lastNode, mySettings, myJavaSettings, Indent.getNoneIndent(), Wrap.createWrap(WrapType.NONE, true), strategy,
|
||||
myFormattingMode);
|
||||
subBlocks.add(block);
|
||||
return new SyntheticCodeBlock(subBlocks, alignment, mySettings, myJavaSettings,
|
||||
Indent.getContinuationWithoutFirstIndent(myIndentSettings.USE_RELATIVE_INDENTS), wrap);
|
||||
}
|
||||
Block block =
|
||||
newJavaBlock(lastNode, mySettings, myJavaSettings, Indent.getNoneIndent(), Wrap.createWrap(WrapType.NONE, true), strategy,
|
||||
myFormattingMode);
|
||||
subBlocks.add(block);
|
||||
return new SyntheticCodeBlock(subBlocks, alignment, mySettings, myJavaSettings,
|
||||
Indent.getContinuationWithoutFirstIndent(myIndentSettings.USE_RELATIVE_INDENTS), wrap);
|
||||
}
|
||||
List<Block> blocks = createJavaBlocks(subNodes);
|
||||
|
||||
|
||||
+4
-4
@@ -83,7 +83,7 @@ class ChainMethodCallsBlockBuilder {
|
||||
}
|
||||
else {
|
||||
if (!myJavaSettings.PLACE_DOT_ON_NEXT_LINE) {
|
||||
wrap = Wrap.createWrap(WrapType.ALWAYS, true);
|
||||
wrap = Wrap.createWrap(mySettings.METHOD_CALL_CHAIN_WRAP, true);
|
||||
} else {
|
||||
wrap = null;
|
||||
}
|
||||
@@ -133,7 +133,7 @@ class ChainMethodCallsBlockBuilder {
|
||||
List<ASTNode> current = new ArrayList<>();
|
||||
if (myJavaSettings.PLACE_DOT_ON_NEXT_LINE) {
|
||||
for (ASTNode node : nodes) {
|
||||
if (tryAddToResult(node, current, result)) {
|
||||
if (tryFinishChunk(node, current, result)) {
|
||||
current = new ArrayList<>();
|
||||
}
|
||||
current.add(node);
|
||||
@@ -141,7 +141,7 @@ class ChainMethodCallsBlockBuilder {
|
||||
} else {
|
||||
for (ASTNode node : nodes) {
|
||||
current.add(node);
|
||||
if (tryAddToResult(node, current, result)) {
|
||||
if (tryFinishChunk(node, current, result)) {
|
||||
current = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
@@ -155,7 +155,7 @@ class ChainMethodCallsBlockBuilder {
|
||||
/**
|
||||
* @return true if current list should be finished
|
||||
*/
|
||||
private static boolean tryAddToResult(ASTNode node, List<ASTNode> current, List<ChainedCallChunk> result) {
|
||||
private static boolean tryFinishChunk(ASTNode node, List<ASTNode> current, List<ChainedCallChunk> result) {
|
||||
if (node.getElementType() == JavaTokenType.DOT || node.getPsi() instanceof PsiComment) {
|
||||
if (!current.isEmpty()) {
|
||||
result.add(new ChainedCallChunk(current));
|
||||
|
||||
@@ -511,7 +511,7 @@ group.javadoc.alignment=Alignment
|
||||
checkbox.enable.javadoc.formatting=Enable JavaDoc formatting
|
||||
checkbox.align.parameter.descriptions=Align parameter descriptions
|
||||
checkbox.align.thrown.exception.descriptions=Align thrown exception descriptions
|
||||
checkbox.place.dot.on.next.line=Place dot on next line in chained calls
|
||||
checkbox.place.dot.on.next.line=Place dot on next line
|
||||
checkbox.after.description=After description
|
||||
checkbox.after.parameter.descriptions=After parameter descriptions
|
||||
checkbox.after.return.tag=After return tag
|
||||
|
||||
Reference in New Issue
Block a user