diff --git a/idea/src/org/jetbrains/kotlin/idea/formatter/kotlinSpacingRules.kt b/idea/src/org/jetbrains/kotlin/idea/formatter/kotlinSpacingRules.kt index e203db22616..44e66922325 100644 --- a/idea/src/org/jetbrains/kotlin/idea/formatter/kotlinSpacingRules.kt +++ b/idea/src/org/jetbrains/kotlin/idea/formatter/kotlinSpacingRules.kt @@ -192,6 +192,8 @@ fun createSpacingBuilder(settings: CodeStyleSettings): KotlinSpacingBuilder { after(LBRACKET).spaces(0) before(RBRACKET).spaces(0) + after(LPAR).spaces(0) + before(RPAR).spaces(0) afterInside(LPAR, VALUE_PARAMETER_LIST).spaces(0) beforeInside(RPAR, VALUE_PARAMETER_LIST).spaces(0) diff --git a/idea/testData/formatter/SpacedInsideParans.after.kt b/idea/testData/formatter/SpacedInsideParans.after.kt new file mode 100644 index 00000000000..36e03fa3cd3 --- /dev/null +++ b/idea/testData/formatter/SpacedInsideParans.after.kt @@ -0,0 +1,5 @@ +fun some() { + (1) + (1 + 2) + ("" as Any) +} \ No newline at end of file diff --git a/idea/testData/formatter/SpacedInsideParans.kt b/idea/testData/formatter/SpacedInsideParans.kt new file mode 100644 index 00000000000..acd9aad59d4 --- /dev/null +++ b/idea/testData/formatter/SpacedInsideParans.kt @@ -0,0 +1,5 @@ +fun some() { + ( 1 ) + ( 1 + 2 ) + ( "" as Any ) +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/formatter/FormatterTestGenerated.java b/idea/tests/org/jetbrains/kotlin/formatter/FormatterTestGenerated.java index ae00fb65956..f0ab1d2874a 100644 --- a/idea/tests/org/jetbrains/kotlin/formatter/FormatterTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/formatter/FormatterTestGenerated.java @@ -499,6 +499,12 @@ public class FormatterTestGenerated extends AbstractFormatterTest { doTest(fileName); } + @TestMetadata("SpacedInsideParans.after.kt") + public void testSpacedInsideParans() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/SpacedInsideParans.after.kt"); + doTest(fileName); + } + @TestMetadata("SpacesAroundOperations.after.kt") public void testSpacesAroundOperations() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/SpacesAroundOperations.after.kt"); diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/smartEnter/SmartEnterTest.kt b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/smartEnter/SmartEnterTest.kt index 9a9f5bf3d2c..f83e2d3edd2 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/smartEnter/SmartEnterTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/smartEnter/SmartEnterTest.kt @@ -596,12 +596,12 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() { // Check that no addition {} inserted fun testWhenBadParsed() = doFunTest( """ - when ( { + when ({ } """ , """ - when ( { + when ({ } """