Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devcontainer should install SwiftFormat #712

Open
nicksloan opened this issue Apr 1, 2024 · 3 comments
Open

Devcontainer should install SwiftFormat #712

nicksloan opened this issue Apr 1, 2024 · 3 comments

Comments

@nicksloan
Copy link
Contributor

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
Copy link
Member

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
Copy link
Contributor Author

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants