-
Notifications
You must be signed in to change notification settings - Fork 80
Install Toolchain #1780
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
base: main
Are you sure you want to change the base?
Install Toolchain #1780
Conversation
2bf9753
to
58ff42b
Compare
0b32ffd
to
845d30a
Compare
845d30a
to
3b13b09
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking really good so far! Here are some things I noticed while testing this out locally:
- The toolchain selection dialog is getting really big with this change. I think it makes more sense to make the Swiftly install a separate VS Code command and add it as an action to the toolchain selection dialog. Toolchain selection is more about switching between already installed toolchains anyway.
- Toolchains should be ordered most recent first rather than earliest. E.g. 6.1.1 should be at the top.
* Shows a quick pick dialog to install available Swiftly toolchains | ||
*/ | ||
export async function installSwiftlyToolchain(ctx: WorkspaceContext): Promise<void> { | ||
if (!Swiftly.isSupported()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: through this command's invocation: whenever we're showing an error or info message, we can log it so we can trace later
// Sort toolchains with most recent versions first | ||
const sortedToolchains = sortToolchainsByVersion(uninstalledToolchains); | ||
|
||
const quickPickItems = sortedToolchains.map(toolchain => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: could log available toolchains so we know what they were prompted with
} | ||
|
||
try { | ||
await vscode.window.withProgress( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: some logging of what will be installed, the command, etc.
); | ||
|
||
void showReloadExtensionNotification( | ||
`Swift ${selected.toolchain.name} has been installed and activated. Visual Studio Code needs to be reloaded.` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`Swift ${selected.toolchain.name} has been installed and activated. Visual Studio Code needs to be reloaded.` | |
`Swift ${selected.toolchain.name} has been installed and selected as the active toolchain. Visual Studio Code needs to be reloaded.` |
}); | ||
} | ||
|
||
function parseStableVersion( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: Version#fromString static function has this logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could extend to handle extractSnapshotDate if needed
if (shouldExecute) { | ||
await this.executePostInstallScript(postInstallFilePath, version, logger); | ||
} else { | ||
void vscode.window.showWarningMessage( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: should log too for diagnostics
`This will require administrator privileges.\n\n${validation.summary}\n\n` + | ||
`Do you want to proceed with running the post-install script?`; | ||
|
||
const choice = await vscode.window.showWarningMessage( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: log this
): Promise<void> { | ||
logger?.info(`Executing post-install script for toolchain ${version}`); | ||
|
||
const outputChannel = new SwiftOutputChannel( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: was this a suggestion from someone? Not sure if we want to open a new output channel, but at very least wouldn't we want this to be in our log folder so it's archived?
src/ui/ToolchainSelection.ts
Outdated
/** | ||
* Sorts toolchains by version with most recent first | ||
*/ | ||
function sortToolchainsByVersion<T extends { label: string }>(toolchains: T[]): T[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: seems like close to same logic is in installSwiftlyToolchain.ts?
src/ui/ToolchainSelection.ts
Outdated
return a.name.localeCompare(b.name); | ||
} | ||
|
||
function parseStableVersion( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
src/ui/ToolchainSelection.ts
Outdated
return null; | ||
} | ||
|
||
function extractSnapshotDate(version: string): string | null { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
Feature Issue #1778
Description
Issue: 1778
Tasks