Closed hoangatuan closed 7 months ago
Apparently you may be able to use this to call .formatted()
at the end to get what you want? I haven't tried it, but it sounds interesting!
Hi @ZevEisenberg, I pushed the latest change. I've updated the logic to:
indentation
in the configuration file.tab
to the leading trivia of the syntax is not enough as discuss here.
I follow realm-swift-format approach to solve the problemhey @hoangatuan thanks for effort. I'm wondering why not just use this and skip the property on the configuration. If we that the result is much better because we are using something that goes beyond the indentation we can leave the tab vc spaces war for the rest of the people 😆
@rakaramos Oh wow I don't know about that 😂 That's work too But that code uses indentation = .spaces(2) by default, so should we still support users to configure the indentation in the yaml configure file? (Similar to what apple-swift-format has done)
@hoangatuan I think we can live we 2 spaces 😄 it's not super important for the users to lint something as ephemeral as the mutated source code. this is why we disable all the linters.
@rakaramos I've updated the PR base on your suggestion
What it Does
If
body block &Else
body blockNote
Since we can't get the Xcode indentation setting directly from Swift, I added a
.tabs(1)
to the leading trivia forIf
body block andElse
body block by default. As long as theTab Width
andIndent Width
settings are equal, the Apply schemata will generate formatted code directly.In case
Tab Width
andIndent Width
are different, the Apply schemata will not be able to generate formatted code.However, you can use tools like
swiftformat
orCommand + I
to format the code easily