Closed calda closed 10 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
1fd536f
) 95.06% compared to head (895f57e
) 95.09%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Awesome improvement. Probably the main reason why we don't use wrapAttributes
.
Looks great, thank you!
This PR updates the
wrapAttributes
rules to support being applied differently to computed properties vs stored properties.Take this example SwiftUI view:
We want the
@ViewBuilder
attribute to be on its own line, but the@State
attribute to be on the same line as the property declaration. Previously this wasn't possible. Now this is supported using--computedvarattrs prev-line --storedvarattrs same-line
.Separately, when looking at adopting
--varattributes prev-line
, I noticed a type of case where I think we should preserve the existing formatting instead of wrapping. Take this example, with a max line width of 100 chars:If we unwrap this so the attribute and the
var
are on the same line, since this exceeds the 100 char line width limit thewrap
rule will then re-wrap the code into the following formatting:I updated how
wrapAttributes
handles thesame-line
option, so it will preserve the existing formatting if unwrapping the attribute would cause the newly combined line to exceed the max line width.Let me know if you think this should be an option rather than the default behavior.