Reputation: 9231
On certain occasions, Android Studio will break elvis operator into the next line when I reformat my code. I couldn't find the option to turn it off in the Code Style settings (or I could have missed them). I personally find it cleaner to have it on the same line.
Any helps would be appreciated.
sealed class ConnectionError(val messageResId: Int, val message: String) : NetworkError() {
data class ConnectError(val msg: String?) : ConnectionError(R.string.network_connect_exception, msg
?: "")
data class SocketTimeoutError(val msg: String?) : ConnectionError(R.string.network_sockettimeout_exception, msg
?: "")
}
Upvotes: 0
Views: 397
Reputation: 13947
You need to set the length of the formatted line in android studio:
You see your line is very long.
You usually have a code separator line that indicates where the break will happen if needed.
Upvotes: 2