Should continuation indentation be 2 or 4 spaces?
See original GitHub issuei.e., should code look like this: (2 spaces)
fun f() {
val x =
43
aVeryLongFunctionName(
a, b, c, d, e)
}
or like this? (4 spaces)
fun f() {
val x =
43
aVeryLongFunctionName(
a, b, c, d, e)
}
In favor of 2 spaces:
- That’s what IntelliJ’s code conventions define. We don’t know the reasons. It could be that it’s just simpler this way.
In favor of 4 spaces:
- It’s looks more like Java.
- Given
ktfmt
, it’s as easy to format with 4 as it is with 2.
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Why do most developers prefer indenting code with 2 spaces ...
It should be noted that there are some people want more than 2 spaces for their indentation. There's a name for them in...
Read more >4 Spaces or 2? - DEV Community
We will argue 4 vs 2 spaces until we are blue in the face. ... Indent extension, and as such have been moving...
Read more >Why is two-space tab indent becoming the standard? - Reddit
I generally agree that tabs are better than spaces for indentation. But the problem with different developers changing their size from 4 to...
Read more >Python: using 4 spaces for indentation. Why? - Stack Overflow
I would also argue 4 spaces is objectively better than 2 for code clarity as well. At least for me, I've always found...
Read more >For code indentation, is a single tab equivalent to 2 spaces or ...
Use 4 spaces per indentation level. Continuation lines should align wrapped elements either vertically using Python's implicit line joining ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m in favor of 4 as well not because of Java similarity but because I find
more readable than
Do we have any discussion going here? If not, we should close. We do have double continuation in some cases now: