You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SR-11290 Break rule for where clause in swift-format
Issue Description:
I assume this is intended, but it would be nice to set `.break(.continue), .open` tokens for `where` keyword instead to follow format of Apple's documentation
Your assumption that this is intended is correct; we treat where clauses as being on "equal footing" as the original declaration, because of situations like these:
class SomeClass<T, U, V>:
SomeSuperclass,
SomeProtocol,
SomeOtherProtocol
where
T.SomeAssociatedType == Foo,
U.SomeOtherThing == V
{
}
This indentation clearly delimits the section of inheritances/conformances from generic constraints, whereas indenting the where keyword would blend them (which can be seen in the changes to the tests in your PRs), and also introduce an (IMO) unnecessary level of indentation in front of the entire section.
Since there's no "official/default/recommended" Swift style, if you'd like to continue pursuing your PRs then we're happy to explore alternative approaches, but since the current style applied by the formatter is being depended on by folks using it in production, any explicit style changes (rather than bug fixes) to that style will need to be placed behind a configuration option that is false by default.
If that's the case, I'm totally okay with current format.
I think adding a new option in the configuration would be an alternative approach. However, I would like to hold until we get more demand from others to avoid adding unuseful option. I'll close this ticket
Additional Detail from JIRA
md5: 5e4d000558f77f1d06c1e68edf21a975
is duplicated by:
Issue Description:
I assume this is intended, but it would be nice to set `.break(.continue), .open` tokens for `where` keyword instead to follow format of Apple's documentation
https://docs.swift.org/swift-book/LanguageGuide/Generics.html#ID192
Input:
swift-format produces:
Expected:
Submitted my draft PR about my ideas:
#33
The text was updated successfully, but these errors were encountered: