Skip to content

Commit 0237549

Browse files
use current folder to find active toolchain for toolchain selection (#1893)
1 parent 6c9733e commit 0237549

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/commands.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,19 @@ import { showToolchainSelectionQuickPick } from "./ui/ToolchainSelection";
6565
export type WorkspaceContextWithToolchain = WorkspaceContext & { toolchain: SwiftToolchain };
6666

6767
export function registerToolchainCommands(
68-
toolchain: SwiftToolchain | undefined,
69-
logger: SwiftLogger,
70-
cwd?: vscode.Uri
68+
ctx: WorkspaceContext | undefined,
69+
logger: SwiftLogger
7170
): vscode.Disposable[] {
7271
return [
7372
vscode.commands.registerCommand("swift.createNewProject", () =>
74-
createNewProject(toolchain)
73+
createNewProject(ctx?.globalToolchain)
7574
),
7675
vscode.commands.registerCommand("swift.selectToolchain", () =>
77-
showToolchainSelectionQuickPick(toolchain, logger, cwd)
76+
showToolchainSelectionQuickPick(
77+
ctx?.currentFolder?.toolchain ?? ctx?.globalToolchain,
78+
logger,
79+
ctx?.currentFolder?.folder
80+
)
7881
),
7982
vscode.commands.registerCommand("swift.pickProcess", configuration =>
8083
pickProcess(configuration)

src/extension.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<Api> {
7676
// properly configured.
7777
if (!toolchain) {
7878
// In order to select a toolchain we need to register the command first.
79-
const subscriptions = commands.registerToolchainCommands(undefined, logger, undefined);
79+
const subscriptions = commands.registerToolchainCommands(undefined, logger);
8080
const chosenRemediation = await showToolchainError();
8181
subscriptions.forEach(sub => sub.dispose());
8282

@@ -101,11 +101,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<Api> {
101101
context.subscriptions.push(new SwiftEnvironmentVariablesManager(context));
102102
context.subscriptions.push(SwiftTerminalProfileProvider.register());
103103
context.subscriptions.push(
104-
...commands.registerToolchainCommands(
105-
toolchain,
106-
workspaceContext.logger,
107-
workspaceContext.currentFolder?.folder
108-
)
104+
...commands.registerToolchainCommands(workspaceContext, workspaceContext.logger)
109105
);
110106

111107
// Watch for configuration changes the trigger a reload of the extension if necessary.

0 commit comments

Comments
 (0)