File tree Expand file tree Collapse file tree 2 files changed +27
-6
lines changed Expand file tree Collapse file tree 2 files changed +27
-6
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,12 @@ import * as vscode from "vscode";
1616import { WorkspaceContext } from "../WorkspaceContext" ;
1717import { SwiftLogger } from "../logging/SwiftLogger" ;
1818import { Swiftly , SwiftlyProgressData } from "../toolchain/swiftly" ;
19- import { askWhereToSetToolchain } from "../ui/ToolchainSelection" ;
19+ import { SwiftToolchain } from "../toolchain/toolchain" ;
20+ import {
21+ askWhereToSetToolchain ,
22+ setToolchainPath ,
23+ showDeveloperDirQuickPick ,
24+ } from "../ui/ToolchainSelection" ;
2025
2126/**
2227 * Installs a Swiftly toolchain and shows a progress notification to the user.
@@ -165,6 +170,12 @@ export async function promptToInstallSwiftlyToolchain(
165170 return ;
166171 }
167172
173+ const xcodes = await SwiftToolchain . findXcodeInstalls ( ) ;
174+ const developerDir = await showDeveloperDirQuickPick ( xcodes ) ;
175+ if ( ! developerDir ) {
176+ return ;
177+ }
178+
168179 // Install the toolchain via Swiftly
169180 if ( ! ( await installSwiftlyToolchainWithProgress ( selected . toolchain . version . name , ctx . logger ) ) ) {
170181 return ;
@@ -178,5 +189,14 @@ export async function promptToInstallSwiftlyToolchain(
178189 ) ;
179190 return ;
180191 }
181- await Swiftly . use ( selected . toolchain . version . name ) ;
192+ await setToolchainPath (
193+ {
194+ category : "swiftly" ,
195+ async onDidSelect ( ) {
196+ await Swiftly . use ( selected . toolchain . version . name ) ;
197+ } ,
198+ } ,
199+ developerDir ,
200+ target
201+ ) ;
182202}
Original file line number Diff line number Diff line change @@ -438,7 +438,7 @@ export async function showToolchainSelectionQuickPick(
438438 * @param xcodePaths An array of paths to available Xcode installations on the system
439439 * @returns The selected DEVELOPER_DIR or undefined if the user cancelled selection
440440 */
441- async function showDeveloperDirQuickPick ( xcodePaths : string [ ] ) : Promise < string | undefined > {
441+ export async function showDeveloperDirQuickPick ( xcodePaths : string [ ] ) : Promise < string | undefined > {
442442 const selected = await vscode . window . showQuickPick < vscode . QuickPickItem > (
443443 SwiftToolchain . getXcodeDeveloperDir ( configuration . swiftEnvironmentVariables ) . then (
444444 existingDeveloperDir => {
@@ -538,15 +538,16 @@ export async function askWhereToSetToolchain(): Promise<vscode.ConfigurationTarg
538538 * @param developerDir
539539 * @returns
540540 */
541- async function setToolchainPath (
541+ export async function setToolchainPath (
542542 toolchain : {
543543 category : SwiftToolchainItem [ "category" ] ;
544544 swiftFolderPath ?: string ;
545545 onDidSelect ?: SwiftToolchainItem [ "onDidSelect" ] ;
546546 } ,
547- developerDir ?: string
547+ developerDir ?: string ,
548+ target ?: vscode . ConfigurationTarget
548549) : Promise < void > {
549- const target = await askWhereToSetToolchain ( ) ;
550+ target = target ?? ( await askWhereToSetToolchain ( ) ) ;
550551 if ( ! target ) {
551552 return ;
552553 }
You can’t perform that action at this time.
0 commit comments