Skip to content

Only use the context key for enabling the "swift.switchPlatform" command #1567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@
},
{
"command": "swift.switchPlatform",
"when": "swift.isActivated && isMac && swift.switchPlatformAvailable"
"when": "swift.switchPlatformAvailable"
},
{
"command": "swift.insertFunctionComment",
Expand Down
7 changes: 4 additions & 3 deletions src/contextKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,10 @@ function createContextKeys(): ContextKeys {
this.createNewProjectAvailable = toolchainVersion.isGreaterThanOrEqual(
new Version(5, 8, 0)
);
this.switchPlatformAvailable = toolchainVersion.isGreaterThanOrEqual(
new Version(6, 1, 0)
);
this.switchPlatformAvailable =
process.platform === "darwin"
? toolchainVersion.isGreaterThanOrEqual(new Version(6, 1, 0))
: false;
},

get isActivated() {
Expand Down
2 changes: 0 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,6 @@ async function createActiveToolchain(
} catch (error) {
outputChannel.log("Failed to discover Swift toolchain");
outputChannel.log(`${error}`);
contextKeys.createNewProjectAvailable = false;
contextKeys.switchPlatformAvailable = false;
return undefined;
}
}
Expand Down