Skip to content

Commit 0dadcf8

Browse files
Add fallback in toolchain selection for Swiftly.inUseVersion() when using swiftly 1.0.1 (#2014)
1 parent b9fd2dd commit 0dadcf8

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## {{releaseVersion}} - {{releaseDate}}
44

5+
### Fixed
6+
7+
- Fix the wrong toolchain being shown as selected when using swiftly v1.0.1 ([#2014](https://github.com/swiftlang/vscode-swift/pull/2014))
8+
59
## 2.14.3 - 2025-12-15
610

711
### Fixed

src/ui/ToolchainSelection.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,16 @@ async function getQuickPickItems(
278278
);
279279

280280
if (activeToolchain) {
281-
const currentSwiftlyVersion =
282-
activeToolchain.manager === "swiftly"
283-
? await Swiftly.inUseVersion("swiftly", cwd)
284-
: undefined;
281+
let currentSwiftlyVersion: string | undefined = undefined;
282+
if (activeToolchain.manager === "swiftly") {
283+
currentSwiftlyVersion = await Swiftly.inUseVersion("swiftly", cwd);
284+
if (currentSwiftlyVersion === undefined) {
285+
// swiftly <1.1.0 does not support JSON output and will report no active
286+
// toolchain version. Fall back to using the active toolchain version as a
287+
// last resort.
288+
currentSwiftlyVersion = activeToolchain.swiftVersion.toString();
289+
}
290+
}
285291
const toolchainInUse = [...xcodes, ...publicToolchains, ...swiftlyToolchains].find(
286292
toolchain => {
287293
if (currentSwiftlyVersion) {

0 commit comments

Comments
 (0)