You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the introduction of swiftly's `.swift-version` file the active
toolchain can now be per-folder instead of global. If the user has
multiple different packages open they may each be using a different
toolchain as defined by their `.swift-version` file.
In order to support this new paradigm the `toolchain` has been moved
from `WorkspaceContext` to `FolderContext`. Each time a folder (package)
is added to the workspace a new toolchain is created, as it might be
different from folder to folder.
The toolchain created respects the `.swift-version` file. If the
toolchain specified in the `.swift-version` file is not installed an
error message is shown prompting the user to install the version with
swiftly.
There is still a `globalToolchain` on the `WorkspaceContext` which
refers to the globally available toolchain. This would be the toolchain
used when you run `swift` outside of a workspace folder. This is mainly
used as a fallback toolchain for when there are no workspace folders.
It is generally advisable to use the toolchain provided on the
`FolderContext` to ensure you don't end up using mismatched versions.
This PR also refactors the `LanguageClientManager` so that one instance
of sourcekit-lsp is started per-toolchain, coordinating startup so that
the server from a given toolchain starts up when a folder using that
toolchain is added to the workspace.
While this PR adds support for .swift-version files, there is still
quite a bit of work to do to make using swiftly with the VS Code Swift
extension a nicer experience including: Installing swiftly directly from
the extension, downloading missing toolchains automatically,
listing/picking/downloading toolchains via `swiftly list`, a smoother
toolchain switching experience that would optionally write the
`.swift-version` file, and more.
0 commit comments