Skip to content

Commit 57aa572

Browse files
only use the "swift.switchPlatformAvailable" context key to enable the "swift.switchPlatform" command (#1567)
1 parent 17883e5 commit 57aa572

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@
908908
},
909909
{
910910
"command": "swift.switchPlatform",
911-
"when": "swift.isActivated && isMac && swift.switchPlatformAvailable"
911+
"when": "swift.switchPlatformAvailable"
912912
},
913913
{
914914
"command": "swift.insertFunctionComment",

src/contextKeys.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,10 @@ function createContextKeys(): ContextKeys {
110110
this.createNewProjectAvailable = toolchainVersion.isGreaterThanOrEqual(
111111
new Version(5, 8, 0)
112112
);
113-
this.switchPlatformAvailable = toolchainVersion.isGreaterThanOrEqual(
114-
new Version(6, 1, 0)
115-
);
113+
this.switchPlatformAvailable =
114+
process.platform === "darwin"
115+
? toolchainVersion.isGreaterThanOrEqual(new Version(6, 1, 0))
116+
: false;
116117
},
117118

118119
get isActivated() {

src/extension.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,6 @@ async function createActiveToolchain(
243243
} catch (error) {
244244
outputChannel.log("Failed to discover Swift toolchain");
245245
outputChannel.log(`${error}`);
246-
contextKeys.createNewProjectAvailable = false;
247-
contextKeys.switchPlatformAvailable = false;
248246
return undefined;
249247
}
250248
}

0 commit comments

Comments
 (0)