I'm using this config: --indent tabs --tabwidth 2.
When formatting this code:
func f() {
switch value {
case .a,
.b:
print("a or b")
case .c:
print("c")
}
}
it produces this output:
func f() {
switch value {
case .a,
.b:
print("a or b")
case .c:
print("c")
}
}
While this looks good in my editor with a tabwidth of 2, it does not look good on github (tabwidth 8) or for my colleagues not using my tabwidth.
We decided to use tabs over spaces to have everyone to display the code as one likes.
I would love to be able to do this: --indent smarttabs
func f() {
switch value {
case .a,
.b:
print("a or b")
case .c:
print("c")
}
}
Here the line after case will only be indented the same as the case line with tabs. Then spaces will be inserted to align the both ..
In case you haven't heard of SmartTabs before, here is a nice gif displaying it:

https://github.com/editorconfig/editorconfig/issues/323#issuecomment-327815131
Would be really awesome if you could add this 馃槏
Hmm, I think this is actually how it used to work prior to 0.41.0, when I changed tabs to behave more like Xcode. Perhaps the original behavior was actually better.
With the current behavior you have to define the tabwidth for alignment to work.
At least in my eyes the advantage of using (smart)tabs is that you don't need to know the tabwidth.
I'd really appreciate if you'd add a configuration for this 馃憤
We decided to use tabs over spaces to have everyone to display the code as one likes.
Bless you <3
I wish more folks understood this.
@jandamm @PompeiaPaetenari I've added a --smarttabs option in 0.45.0 (enabled by default).
Works perfectly. Thanks! 馃憤
Most helpful comment
@jandamm @PompeiaPaetenari I've added a
--smarttabsoption in 0.45.0 (enabled by default).