Fix spacing after return (KT-4947)
#KT-4947 Fixed
This commit is contained in:
@@ -82,6 +82,10 @@ fun createSpacingBuilder(settings: CodeStyleSettings): KotlinSpacingBuilder {
|
|||||||
betweenInside(TYPE_REFERENCE, DOT, PROPERTY).spacing(0, 0, 0, false, 0)
|
betweenInside(TYPE_REFERENCE, DOT, PROPERTY).spacing(0, 0, 0, false, 0)
|
||||||
betweenInside(DOT, IDENTIFIER, PROPERTY).spacing(0, 0, 0, false, 0)
|
betweenInside(DOT, IDENTIFIER, PROPERTY).spacing(0, 0, 0, false, 0)
|
||||||
|
|
||||||
|
betweenInside(RETURN_KEYWORD, LABEL_QUALIFIER, RETURN).spaces(0)
|
||||||
|
afterInside(RETURN_KEYWORD, RETURN).spaces(1)
|
||||||
|
afterInside(LABEL_QUALIFIER, RETURN).spaces(1)
|
||||||
|
|
||||||
betweenInside(FUN_KEYWORD, IDENTIFIER, FUN).spaces(1)
|
betweenInside(FUN_KEYWORD, IDENTIFIER, FUN).spaces(1)
|
||||||
betweenInside(FUN_KEYWORD, TYPE_REFERENCE, FUN).spaces(1)
|
betweenInside(FUN_KEYWORD, TYPE_REFERENCE, FUN).spaces(1)
|
||||||
betweenInside(TYPE_REFERENCE, DOT, FUN).spacing(0, 0, 0, false, 0)
|
betweenInside(TYPE_REFERENCE, DOT, FUN).spacing(0, 0, 0, false, 0)
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
fun test1(): Int {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test2(): Int {
|
||||||
|
return
|
||||||
|
1
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test3(): Int {
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
1
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test4(): Int {
|
||||||
|
return synchronized(this) {(): Int ->
|
||||||
|
return@synchronized 12
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test5(): Int {
|
||||||
|
return synchronized(this) {(): Int ->
|
||||||
|
return@synchronized 12
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test6(): Int {
|
||||||
|
return synchronized(this) {(): Int ->
|
||||||
|
return
|
||||||
|
|
||||||
|
@synchronized
|
||||||
|
|
||||||
|
12
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
fun test1(): Int {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test2(): Int {
|
||||||
|
return
|
||||||
|
1
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test3(): Int {
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
1
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test4(): Int {
|
||||||
|
return synchronized(this) {(): Int ->
|
||||||
|
return@synchronized 12
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test5(): Int {
|
||||||
|
return synchronized(this) {(): Int ->
|
||||||
|
return @synchronized 12
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test6(): Int {
|
||||||
|
return synchronized(this) {(): Int ->
|
||||||
|
return
|
||||||
|
|
||||||
|
@synchronized
|
||||||
|
|
||||||
|
12
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
fun test(): Int {
|
||||||
|
return
|
||||||
|
<caret>
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fun test(): Int {
|
||||||
|
return <caret>
|
||||||
|
}
|
||||||
@@ -244,6 +244,11 @@ public class JetFormatterTestGenerated extends AbstractJetFormatterTest {
|
|||||||
doTest("idea/testData/formatter/RemoveSpacesAroundOperations.after.kt");
|
doTest("idea/testData/formatter/RemoveSpacesAroundOperations.after.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("ReturnExpression.after.kt")
|
||||||
|
public void testReturnExpression() throws Exception {
|
||||||
|
doTest("idea/testData/formatter/ReturnExpression.after.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("RightBracketOnNewLine.after.kt")
|
@TestMetadata("RightBracketOnNewLine.after.kt")
|
||||||
public void testRightBracketOnNewLine() throws Exception {
|
public void testRightBracketOnNewLine() throws Exception {
|
||||||
doTest("idea/testData/formatter/RightBracketOnNewLine.after.kt");
|
doTest("idea/testData/formatter/RightBracketOnNewLine.after.kt");
|
||||||
@@ -454,7 +459,9 @@ public class JetFormatterTestGenerated extends AbstractJetFormatterTest {
|
|||||||
@InnerTestClasses({})
|
@InnerTestClasses({})
|
||||||
public static class FormatterInverted extends AbstractJetFormatterTest {
|
public static class FormatterInverted extends AbstractJetFormatterTest {
|
||||||
public void testAllFilesPresentInFormatterInverted() throws Exception {
|
public void testAllFilesPresentInFormatterInverted() throws Exception {
|
||||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/formatter"), Pattern.compile("^([^\\.]+)\\.after\\.inv\\.kt.*$"), true);
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage",
|
||||||
|
new File("idea/testData/formatter"),
|
||||||
|
Pattern.compile("^([^\\.]+)\\.after\\.inv\\.kt.*$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("BinaryExpressions.after.inv.kt")
|
@TestMetadata("BinaryExpressions.after.inv.kt")
|
||||||
|
|||||||
@@ -61,7 +61,9 @@ public class JetTypingIndentationTestBaseGenerated extends AbstractJetTypingInde
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testAllFilesPresentInDirectSettings() throws Exception {
|
public void testAllFilesPresentInDirectSettings() throws Exception {
|
||||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/indentationOnNewline"), Pattern.compile("^([^\\.]+)\\.after\\.kt.*$"), true);
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage",
|
||||||
|
new File("idea/testData/indentationOnNewline"),
|
||||||
|
Pattern.compile("^([^\\.]+)\\.after\\.kt.*$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("ConsecutiveCallsAfterDot.after.kt")
|
@TestMetadata("ConsecutiveCallsAfterDot.after.kt")
|
||||||
@@ -214,6 +216,11 @@ public class JetTypingIndentationTestBaseGenerated extends AbstractJetTypingInde
|
|||||||
doNewlineTest("idea/testData/indentationOnNewline/PropertyWithInference.after.kt");
|
doNewlineTest("idea/testData/indentationOnNewline/PropertyWithInference.after.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("ReturnContinue.after.kt")
|
||||||
|
public void testReturnContinue() throws Exception {
|
||||||
|
doNewlineTest("idea/testData/indentationOnNewline/ReturnContinue.after.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("SettingAlignMultilineParametersInCalls.after.kt")
|
@TestMetadata("SettingAlignMultilineParametersInCalls.after.kt")
|
||||||
public void testSettingAlignMultilineParametersInCalls() throws Exception {
|
public void testSettingAlignMultilineParametersInCalls() throws Exception {
|
||||||
doNewlineTest("idea/testData/indentationOnNewline/SettingAlignMultilineParametersInCalls.after.kt");
|
doNewlineTest("idea/testData/indentationOnNewline/SettingAlignMultilineParametersInCalls.after.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user