Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 46 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,13 @@
"order": 4,
"scope": "machine-overridable"
},
"swift.suppressSwiftlyInstallPrompt": {
"type": "boolean",
"default": false,
"markdownDescription": "Suppress the automatic Swiftly installation prompt when no Swift toolchain is found.",
"order": 98,
"scope": "application"
},
"swift.diagnostics": {
"type": "boolean",
"default": false,
Expand Down Expand Up @@ -2033,6 +2040,7 @@
"@types/sinon-chai": "^3.2.12",
"@types/svg2ttf": "^5.0.3",
"@types/svgicons2svgfont": "^10.0.5",
"@types/tar": "^6.1.13",
"@types/ttf2woff": "^2.0.4",
"@types/vscode": "^1.88.0",
"@types/xml2js": "^0.4.14",
Expand Down Expand Up @@ -2081,6 +2089,7 @@
"fast-glob": "^3.3.3",
"lcov-parse": "^1.0.0",
"plist": "^3.1.0",
"tar": "^6.2.1",
"vscode-languageclient": "^9.0.1",
"xml2js": "^0.6.2",
"zod": "^4.1.5"
Expand Down
26 changes: 26 additions & 0 deletions src/PackageWatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ import * as vscode from "vscode";

import { FolderContext } from "./FolderContext";
import { FolderOperation } from "./WorkspaceContext";
import { handleMissingSwiftly } from "./commands/installSwiftly";
import { SwiftLogger } from "./logging/SwiftLogger";
import { BuildFlags } from "./toolchain/BuildFlags";
import { handleMissingSwiftlyToolchain } from "./toolchain/swiftly";
import { showReloadExtensionNotification } from "./ui/ReloadExtension";
import { fileExists } from "./utilities/filesystem";
import { Version } from "./utilities/version";
Expand Down Expand Up @@ -140,6 +142,30 @@ export class PackageWatcher {
async handleSwiftVersionFileChange() {
const version = await this.readSwiftVersionFile();
if (version?.toString() !== this.currentVersion?.toString()) {
if (version) {
const swiftlyInstalled = await handleMissingSwiftly(this.logger);
if (swiftlyInstalled) {
const toolchainInstalled = await handleMissingSwiftlyToolchain(
version.toString(),
this.logger,
this.folderContext.folder
);
if (toolchainInstalled) {
// Build dynamic message based on installation results
const message =
"Swiftly and Swift toolchain have been installed. Please reload the extension to use the new toolchain.";
await showReloadExtensionNotification(message);
return;
} else {
// Only Swiftly was installed
const message =
"Swiftly has been installed. Please reload the extension to continue.";
await showReloadExtensionNotification(message);
return;
}
}
}

await this.folderContext.fireEvent(FolderOperation.swiftVersionUpdated);
await showReloadExtensionNotification(
"Changing the swift toolchain version requires the extension to be reloaded"
Expand Down
Loading