KT-2254 Incorrect indentation after = in val:

#KT-2254 fixed
This commit is contained in:
Nikolay Krasko
2012-06-27 21:01:55 +04:00
parent d308311aeb
commit 4a0b13d11e
12 changed files with 46 additions and 4 deletions
@@ -37,8 +37,8 @@ import java.util.*;
* @see Block for good JavaDoc documentation
*/
public class JetBlock extends AbstractBlock {
private Indent myIndent;
private CodeStyleSettings mySettings;
private final Indent myIndent;
private final CodeStyleSettings mySettings;
private final SpacingBuilder mySpacingBuilder;
private List<Block> mySubBlocks;
@@ -158,6 +158,10 @@ public class JetBlock extends AbstractBlock {
return new ChildAttributes(Indent.getContinuationIndent(), null);
}
if (isIncomplete()) {
return super.getChildAttributes(newChildIndex);
}
return new ChildAttributes(Indent.getNoneIndent(), null);
}
@@ -266,7 +270,11 @@ public class JetBlock extends AbstractBlock {
ASTIndentStrategy.forNode("For single statement in THEN and ELSE")
.in(JetNodeTypes.THEN, JetNodeTypes.ELSE)
.notForType(JetNodeTypes.BLOCK)
.set(Indent.getNormalIndent())
.set(Indent.getNormalIndent()),
ASTIndentStrategy.forNode("Indent for parts")
.in(JetNodeTypes.PROPERTY, JetNodeTypes.FUN)
.set(Indent.getContinuationWithoutFirstIndent()),
};
@Nullable
@@ -7,7 +7,7 @@ trait Trait {
class TraitImpl : Trait {
override fun <A, B: Runnable, E: Map.Entry<A, B>> foo()
where B: Cloneable, B: Comparable<B> {
where B: Cloneable, B: Comparable<B> {
throw UnsupportedOperationException()
}
}
@@ -0,0 +1,3 @@
fun
test() =
12
@@ -0,0 +1,3 @@
fun
test() =
12
@@ -0,0 +1 @@
fun test() =<caret>
@@ -0,0 +1,2 @@
fun test() =
<caret>
@@ -0,0 +1 @@
val a =<caret>
@@ -0,0 +1,2 @@
val a =
<caret>
@@ -0,0 +1,3 @@
val
a =
12
@@ -0,0 +1,3 @@
val
a =
12
@@ -53,6 +53,10 @@ public class JetFormatterTest extends AbstractJetFormatterTest {
doTest();
}
public void testFunctionWithInference() throws Exception {
doTest();
}
public void testGetterAndSetter() throws Exception {
doTest();
}
@@ -65,6 +69,10 @@ public class JetFormatterTest extends AbstractJetFormatterTest {
doTestWithInvert();
}
public void testPropertyWithInference() throws Exception {
doTest();
}
public void testRightBracketOnNewLine() throws Exception {
doTestWithInvert();
}
@@ -53,6 +53,10 @@ public class JetTypingIndentationTest extends LightCodeInsightTestCase {
doFileNewlineTest();
}
public void testFunctionWithInference() {
doFileNewlineTest();
}
public void testIf() {
doFileNewlineTest();
}
@@ -61,6 +65,10 @@ public class JetTypingIndentationTest extends LightCodeInsightTestCase {
doFileNewlineTest();
}
public void testPropertyWithInference() {
doFileNewlineTest();
}
public void testSettingAlignMultilineParametersInCalls() throws Exception {
doFileSettingNewLineTest();
}