Format spaces inside curly braces in string template

Fixes #KT-12791
This commit is contained in:
Kirill Rakhman
2016-06-20 19:34:44 +02:00
committed by Nikolay Krasko
parent 655fc45a87
commit ae83330679
4 changed files with 15 additions and 0 deletions
@@ -214,6 +214,9 @@ fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacing
betweenInside(LPAR, DESTRUCTURING_DECLARATION, FOR).spaces(0)
betweenInside(LOOP_RANGE, RPAR, FOR).spaces(0)
after(LONG_TEMPLATE_ENTRY_START).spaces(0)
before(LONG_TEMPLATE_ENTRY_END).spaces(0)
val TYPE_COLON_ELEMENTS = TokenSet.create(PROPERTY, FUN, VALUE_PARAMETER, DESTRUCTURING_DECLARATION_ENTRY, FUNCTION_LITERAL)
beforeInside(COLON, TYPE_COLON_ELEMENTS) { spaceIf(kotlinSettings.SPACE_BEFORE_TYPE_COLON) }
afterInside(COLON, TYPE_COLON_ELEMENTS) { spaceIf(kotlinSettings.SPACE_AFTER_TYPE_COLON) }
@@ -0,0 +1,3 @@
fun foo() {
"${1}"
}
@@ -0,0 +1,3 @@
fun foo() {
"${ 1 }"
}
@@ -151,6 +151,12 @@ public class FormatterTestGenerated extends AbstractFormatterTest {
doTest(fileName);
}
@TestMetadata("CurlyBraceStringInterpolation.after.kt")
public void testCurlyBraceStringInterpolation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/CurlyBraceStringInterpolation.after.kt");
doTest(fileName);
}
@TestMetadata("DelegationList.after.kt")
public void testDelegationList() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/DelegationList.after.kt");