Is anyone else employing tricks to preserve line breaks? For long function chains I like the calls arranged vertically and sometimes I'll force it by adding a comment after the function calls. Does anyone have any better ideas?
c
Colton Idle
05/01/2023, 2:04 PM
Not really a helpful answer or anything, but I always thought ktfmt specifically prevented the ability to do this kind of thing?
n
Nivaldo H Bondança
08/24/2023, 2:32 PM
What kind of line breaks are you talking about @pardom?
r
Ryan Sang
03/20/2024, 4:05 PM
I have a similar desire for call chains like:
Copy code
listOf(1, 2, 3)
.filter { it > 2 }
.map { it + 2 }
.sum()
These will generally be compressed down to one line depending on length, whereas my company's preferred style would be to preserve intentional new lines (which is admittedly against the ideas of the google java formatter).