Handle spaces around dot in type references and before type argument list

This commit is contained in:
Ilya Zorin
2017-05-31 20:06:53 +03:00
committed by Dmitry Jemerov
parent 4acb95acb5
commit 862631b2ec
6 changed files with 30 additions and 0 deletions
@@ -170,6 +170,7 @@ fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacing
betweenInside(TYPE_REFERENCE, DOT, FUN).spacing(0, 0, 0, false, 0)
betweenInside(DOT, IDENTIFIER, FUN).spacing(0, 0, 0, false, 0)
afterInside(IDENTIFIER, FUN).spacing(0, 0, 0, false, 0)
aroundInside(DOT, USER_TYPE).spaces(0)
around(AS_KEYWORD).spaces(1)
around(IS_KEYWORD).spaces(1)
@@ -211,6 +212,7 @@ fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacing
beforeInside(RPAR, VALUE_ARGUMENT_LIST).spaces(0)
afterInside(LT, TYPE_ARGUMENT_LIST).spaces(0)
beforeInside(GT, TYPE_ARGUMENT_LIST).spaces(0)
before(TYPE_ARGUMENT_LIST).spaces(0)
betweenInside(FOR_KEYWORD, LPAR, FOR).spacing(1, 1, 0, false, 0)
betweenInside(IF_KEYWORD, LPAR, IF).spacing(1, 1, 0, false, 0)
@@ -0,0 +1,4 @@
fun some(param: kotlin.Int): kotlin.Int {
val num: kotlin.Int = 0
return num
}
@@ -0,0 +1,4 @@
fun some(param: kotlin . Int): kotlin .Int {
val num: kotlin. Int = 0
return num
}
@@ -0,0 +1,4 @@
fun some(param: List<Int>): List<Int> {
val list = emptyList<Int>()
return list
}
@@ -0,0 +1,4 @@
fun some(param: List <Int>): List <Int> {
val list = emptyList <Int>()
return list
}
@@ -572,6 +572,12 @@ public class FormatterTestGenerated extends AbstractFormatterTest {
doTest(fileName);
}
@TestMetadata("SpaceAroundDotInUserReference.after.kt")
public void testSpaceAroundDotInUserReference() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/SpaceAroundDotInUserReference.after.kt");
doTest(fileName);
}
@TestMetadata("SpaceAroundExtendColon.after.kt")
public void testSpaceAroundExtendColon() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/SpaceAroundExtendColon.after.kt");
@@ -602,6 +608,12 @@ public class FormatterTestGenerated extends AbstractFormatterTest {
doTest(fileName);
}
@TestMetadata("SpaceBeforeTypeArgumentList.after.kt")
public void testSpaceBeforeTypeArgumentList() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/SpaceBeforeTypeArgumentList.after.kt");
doTest(fileName);
}
@TestMetadata("SpacedInsideParans.after.kt")
public void testSpacedInsideParans() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/SpacedInsideParans.after.kt");