I have a container based on Swift 6.0.3. I'm running it in detached mode with an SSH server for remote dev. When I connect with VSCode and install this extension, it prompts me to find a toolchain. The official Swift docker image comes with Swift installed. Why does the plugin need a 'toolchain' when Swift and Friends are readily available? Can I get around this and still use the extension?
This appears to be an issue with the extension when using Remote SSH in VS Code. I was able to reproduce it easily. I filed a new issue against the vscode-swift project to track this:
The workaround is to tell the Swift extension where to find the toolchain in your settings. You can find the path to the toolchain by running which swift
and then adding it to your workspace settings.
E.g.
> which swift
/home/<REDACTED>/.local/share/swiftly/bin/swift
and you can then update your VS Code settings to include:
{
// Note that this is the path to the directory containing the swift binary!
// Make sure to remove the "/swift" from the end of the path in the previous setp.
"swift.path": "/home/<REDACTED>/.local/share/swiftly/bin"
}
To be clear: there is no toolchain (and no swiftly), but selecting the parent directory for ‘swift’ will do it?
That is correct.
The Swiftly path was just an example from my machine. You'll have to find out where the swift binary is in the container and add its parent directory to your VS Code settings.
Thanks for taking the time and the quick response!