From 3038f87105c7399f273b913581502296dd615963 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Thu, 30 Nov 2017 16:22:28 +0100 Subject: [PATCH] Move two continuation indent wrapping options to wrapping page --- .../idea/formatter/KotlinIndentOptionsEditor.kt | 14 -------------- .../KotlinLanguageCodeStyleSettingsProvider.kt | 8 ++++++++ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/formatter/KotlinIndentOptionsEditor.kt b/idea/src/org/jetbrains/kotlin/idea/formatter/KotlinIndentOptionsEditor.kt index 1a1c0094a2e..2cf3e1ced54 100644 --- a/idea/src/org/jetbrains/kotlin/idea/formatter/KotlinIndentOptionsEditor.kt +++ b/idea/src/org/jetbrains/kotlin/idea/formatter/KotlinIndentOptionsEditor.kt @@ -24,49 +24,35 @@ import org.jetbrains.kotlin.idea.core.formatter.KotlinCodeStyleSettings import javax.swing.JCheckBox class KotlinIndentOptionsEditor : SmartIndentOptionsEditor() { - private val useContinuationIndentInParameterList = JCheckBox("Use continuation indent in parameter lists") private val useContinuationIndentForExpressionBodies = JCheckBox("Use continuation indent for expression bodies") - private val useContinuationIndentForChainedCalls = JCheckBox("Use continuation indent for chained calls") override fun addComponents() { super.addComponents() - add(useContinuationIndentInParameterList) add(useContinuationIndentForExpressionBodies) - add(useContinuationIndentForChainedCalls) } override fun isModified(settings: CodeStyleSettings, options: CommonCodeStyleSettings.IndentOptions): Boolean { var isModified = super.isModified(settings, options) val kotlinSettings = settings.kotlinCustomSettings - isModified = isModified || IndentOptionsEditor.isFieldModified(useContinuationIndentInParameterList, - kotlinSettings.CONTINUATION_INDENT_IN_PARAMETER_LISTS) isModified = isModified || IndentOptionsEditor.isFieldModified(useContinuationIndentForExpressionBodies, kotlinSettings.CONTINUATION_INDENT_FOR_EXPRESSION_BODIES) - isModified = isModified || IndentOptionsEditor.isFieldModified(useContinuationIndentForChainedCalls, - kotlinSettings.CONTINUATION_INDENT_FOR_CHAINED_CALLS) return isModified } override fun apply(settings: CodeStyleSettings, options: CommonCodeStyleSettings.IndentOptions) { super.apply(settings, options) val kotlinSettings = settings.getCustomSettings(KotlinCodeStyleSettings::class.java) - kotlinSettings.CONTINUATION_INDENT_IN_PARAMETER_LISTS = useContinuationIndentInParameterList.isSelected kotlinSettings.CONTINUATION_INDENT_FOR_EXPRESSION_BODIES = useContinuationIndentForExpressionBodies.isSelected - kotlinSettings.CONTINUATION_INDENT_FOR_CHAINED_CALLS = useContinuationIndentForChainedCalls.isSelected } override fun reset(settings: CodeStyleSettings, options: CommonCodeStyleSettings.IndentOptions) { super.reset(settings, options) val kotlinSettings = settings.getCustomSettings(KotlinCodeStyleSettings::class.java) - useContinuationIndentInParameterList.isSelected = kotlinSettings.CONTINUATION_INDENT_IN_PARAMETER_LISTS useContinuationIndentForExpressionBodies.isSelected = kotlinSettings.CONTINUATION_INDENT_FOR_EXPRESSION_BODIES - useContinuationIndentForChainedCalls.isSelected = kotlinSettings.CONTINUATION_INDENT_FOR_CHAINED_CALLS } override fun setEnabled(enabled: Boolean) { super.setEnabled(enabled) - useContinuationIndentInParameterList.isEnabled = enabled useContinuationIndentForExpressionBodies.isEnabled = enabled - useContinuationIndentForChainedCalls.isEnabled = enabled } } \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/formatter/KotlinLanguageCodeStyleSettingsProvider.kt b/idea/src/org/jetbrains/kotlin/idea/formatter/KotlinLanguageCodeStyleSettingsProvider.kt index ef591602e59..a64dbfae8f1 100644 --- a/idea/src/org/jetbrains/kotlin/idea/formatter/KotlinLanguageCodeStyleSettingsProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/formatter/KotlinLanguageCodeStyleSettingsProvider.kt @@ -269,6 +269,14 @@ class KotlinLanguageCodeStyleSettingsProvider : LanguageCodeStyleSettingsProvide "Put left brace on new line", CodeStyleSettingsCustomizable.WRAPPING_BRACES) + showCustomOption( + KotlinCodeStyleSettings::CONTINUATION_INDENT_IN_PARAMETER_LISTS, + "Use continuation indent", + CodeStyleSettingsCustomizable.WRAPPING_METHOD_PARAMETERS) + showCustomOption( + KotlinCodeStyleSettings::CONTINUATION_INDENT_FOR_CHAINED_CALLS, + "Use continuation indent", + CodeStyleSettingsCustomizable.WRAPPING_CALL_CHAIN) showCustomOption( KotlinCodeStyleSettings::CONTINUATION_INDENT_IN_SUPERTYPE_LISTS, "Use continuation indent",