swiftlang / vscode-swift

Visual Studio Code Extension for Swift
https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang
Apache License 2.0
753 stars 54 forks source link

My Mac can't upgrade to the latest operating system, so I can't use XCode to experience Swift5.9, but I want to experience Swift5.9 in VSCode, what should I do without changing the configuration of XCode #622

Closed leiyutinghua closed 1 year ago

leiyutinghua commented 1 year ago

Is your feature request related to a problem? Please describe. My Mac can't upgrade to the latest operating system, so I can't use XCode to experience Swift5.9, but I want to experience Swift5.9 in VSCode, what should I do without changing the configuration of XCode

Describe the solution you'd like My Mac can't upgrade to the latest operating system, so I can't use XCode to experience Swift5.9, but I want to experience Swift5.9 in VSCode, what should I do without changing the configuration of XCode

Describe alternatives you've considered My Mac can't upgrade to the latest operating system, so I can't use XCode to experience Swift5.9, but I want to experience Swift5.9 in VSCode, what should I do without changing the configuration of XCode

stevapple commented 1 year ago

You can utilize VSCode’s Dev Container feature as documented here: https://github.com/swift-server/vscode-swift/blob/main/docs/remote-dev.md

It uses Docker to run Swift on Linux (in a lightweight VM). IIRC there’s no reliable way to run a Swift macOS toolchain on an unsupported OS version.

stevapple commented 1 year ago

@adam-fowler Maybe we can change the file name from remote-dev to dev-container? It doesn’t contain anything about remote development now.

stevapple commented 1 year ago

@leiyutinghua Another way is to try the official toolchain release from Swift.org. It supports a wider (but not arbitrary) range of macOS version than Xcode.

After installing the toolchain, you can change the plugin settings inside VSCode to point Swift executable to the one provided by the installed toolchain. If your macOS is compatible, everything should work as expected.

adam-fowler commented 1 year ago

@adam-fowler Maybe we can change the file name from remote-dev to dev-container? It doesn’t contain anything about remote development now.

Want to do a PR?

adam-fowler commented 1 year ago

If your macOS is compatible, everything should work as expected.

I think the version of XCTest for 5.9 is only available as bundled with Xcode and 5.8 XCTest is not compatible with 5.9.

adam-fowler commented 1 year ago

As mentioned above https://github.com/swift-server/vscode-swift/issues/622#issuecomment-1764148370 dev containers are the best way to experience a different version of swift on MacOS