Reputation: 25
When press CTRL+ALT+L formatting, Code will change from CodeA to CodeB.
Can I keep the CodeA without automatically new line?
CodeA:
object Constant {
/** http request successful */
const val HTTP_SUC = 1
/** http request failed */
const val HTTP_ERR = -1
/** No line breaks above */
const val TEST = 0
}
CodeB:
object Constant {
/** http request successful */
const val HTTP_SUC = 1
/** http request failed */
const val HTTP_ERR = -1
/** There is a new line on it */
const val TEST = 0
}
Upvotes: 2
Views: 641
Reputation: 171
It's been a long time but maybe someone else stumbles upon this.
Currently Android Studio has such preference to set any number of lines to put before a comment or an annotation line. Please go to File> Settings> Editor> Code Style> Kotlin then go to "Blank Lines" tab and at the below "Minimum Blank Lines" section, type "0" for the "Before declaration with comment or annotation" option.
Additionally you can check "Keep when reformatting"> "Line Breaks" from the "Wrapping and Braces" tab to keep your manual lines.
Upvotes: 2
Reputation: 3268
No, If you want not to have extra line, you should do it manually. When you use shortcut for doing so, you will have extra line.
Upvotes: 1