Closed calda closed 2 years ago
Seems reasonable, although I think you could probably just set it to 999 or something and have the same effect?
Good idea, if --swiftversion 999
works then we probably don't need a latest
option
It might be worth adding an explicit "latest" option anyway, otherwise it would prohibit me from adding a warning for unknown swift version in future.
Cool, I do prefer --swiftformat latest
from a semantic / self-documenting perspective. I'll make a PR.
@calda I think based on the PR discussion we're not doing this, right?
Yeah, I figured we can just leave it as-is since there isn't a clear / simple direction for inferring this. In our SPM package plugin that wraps SwiftFormat I did start grabbing the Package.swift
swift-tools-version
(https://github.com/airbnb/swift/pull/180) which I think works nicely for SPM packages, but there isn't a clean / simple way to do this for other types of projects.
We specify a
--swiftversion
flag in ourairbnb.swiftformat
file so that version-dependent format rule implementations use all of the latest language features. We have to periodically update this, so it can drift out of date.Any thoughts on including a
--swiftversion latest
option, to automatically format according to the most recent available language version?