Option to use normal indent in chained calls
#KT-18605 Fixed
This commit is contained in:
@@ -26,11 +26,13 @@ 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 {
|
||||
@@ -40,6 +42,8 @@ class KotlinIndentOptionsEditor : SmartIndentOptionsEditor() {
|
||||
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
|
||||
}
|
||||
|
||||
@@ -48,6 +52,7 @@ class KotlinIndentOptionsEditor : SmartIndentOptionsEditor() {
|
||||
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) {
|
||||
@@ -55,11 +60,13 @@ class KotlinIndentOptionsEditor : SmartIndentOptionsEditor() {
|
||||
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
|
||||
}
|
||||
}
|
||||
+2
@@ -125,6 +125,8 @@ class KotlinLanguageCodeStyleSettingsProvider : LanguageCodeStyleSettingsProvide
|
||||
foo: String,
|
||||
bar: String
|
||||
) {
|
||||
foo
|
||||
.length
|
||||
}
|
||||
|
||||
fun expressionBodyMethod() =
|
||||
|
||||
Reference in New Issue
Block a user