Format spaces inside curly braces in string template
Fixes #KT-12791
This commit is contained in:
committed by
Nikolay Krasko
parent
655fc45a87
commit
ae83330679
@@ -214,6 +214,9 @@ fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacing
|
|||||||
betweenInside(LPAR, DESTRUCTURING_DECLARATION, FOR).spaces(0)
|
betweenInside(LPAR, DESTRUCTURING_DECLARATION, FOR).spaces(0)
|
||||||
betweenInside(LOOP_RANGE, RPAR, 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)
|
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) }
|
beforeInside(COLON, TYPE_COLON_ELEMENTS) { spaceIf(kotlinSettings.SPACE_BEFORE_TYPE_COLON) }
|
||||||
afterInside(COLON, TYPE_COLON_ELEMENTS) { spaceIf(kotlinSettings.SPACE_AFTER_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);
|
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")
|
@TestMetadata("DelegationList.after.kt")
|
||||||
public void testDelegationList() throws Exception {
|
public void testDelegationList() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/DelegationList.after.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/DelegationList.after.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user