soto-project / soto

Swift SDK for AWS that works on Linux, macOS and iOS
https://soto.codes
Apache License 2.0
878 stars 83 forks source link

Devcontainer should install SwiftFormat #712

Open nicksloan opened 6 months ago

nicksloan commented 6 months ago

Is your feature request related to a problem? Please describe. Devcontainers are an easy way to let people contribute productively to the project, but SwiftFormat is missing. It would be nice to give contributors everything they might need to be good citizens of the project.

Describe the solution you'd like Let's install SwiftFormat in the devcontainer automatically.

Describe alternatives you've considered I've not considered any alternate approaches. If the proposed solution is unacceptable, I think this issue can be closed.

Additional context Linux builds are available on Github as a zip file. See https://github.com/nicklockwood/SwiftFormat/releases

adam-fowler commented 6 months ago

As I understand the SwiftFormat zips aren't built with static linking, so won't work from one version of swift to another. I maybe wrong. There is a devcontainer feature which clones the repo and builds it from code. For some reason though it takes for ever. You can run VSCode command DevContainers: Configure Container Features... to install this.

nicksloan commented 5 months ago

I think they will work across different versions of Swift as of Swift 5.8 (if I'm reading the README correctly), but each version of swift-format only supports the latest Swift version supported by the version of SwiftSyntax that it depends on. So it doesn't matter which version of Swift is installed, you can always run it, but it won't know what to do with new syntax that didn't exist when the version being used was released. I'll experiment a bit and report back.

adam-fowler commented 5 months ago

I didn't word that correctly. By different version of swift I meant platform. If I was to use the version of SwiftFormat linked to the release I'd have to make sure I'm using the same version of Ubuntu that it was compiled on.

Also I think you are mixing up Apple's swift-format with Nick Lockwood's SwiftFormat. Nick's version doesn't use SwiftSyntax as far as I know.