From f236b9f1d98aa9f4184dd698995f8c207f27362b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 10 Oct 2025 21:01:47 +0000 Subject: [PATCH 1/2] Initial plan From 549fd1adb1568ab6402c83775796664113ffe985 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 10 Oct 2025 21:16:19 +0000 Subject: [PATCH 2/2] Fix: Open file browser at workspace root when selecting interpreter path - Added defaultUri parameter to showOpenDialog to open at current workspace - Updated all related unit tests to include defaultUri in expected parameters - Added new test case to verify workspace URI is used as defaultUri Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com> --- .../commands/setInterpreter.ts | 1 + .../commands/setInterpreter.unit.test.ts | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/client/interpreter/configuration/interpreterSelector/commands/setInterpreter.ts b/src/client/interpreter/configuration/interpreterSelector/commands/setInterpreter.ts index 54440485da02..a629d1bc793c 100644 --- a/src/client/interpreter/configuration/interpreterSelector/commands/setInterpreter.ts +++ b/src/client/interpreter/configuration/interpreterSelector/commands/setInterpreter.ts @@ -554,6 +554,7 @@ export class SetInterpreterCommand extends BaseInterpreterSelectorCommand implem openLabel: InterpreterQuickPickList.browsePath.openButtonLabel, canSelectMany: false, title: InterpreterQuickPickList.browsePath.title, + defaultUri: state.workspace, }); if (uris && uris.length > 0) { state.path = uris[0].fsPath; diff --git a/src/test/configuration/interpreterSelector/commands/setInterpreter.unit.test.ts b/src/test/configuration/interpreterSelector/commands/setInterpreter.unit.test.ts index 0016ca339bfe..7837245ec9d2 100644 --- a/src/test/configuration/interpreterSelector/commands/setInterpreter.unit.test.ts +++ b/src/test/configuration/interpreterSelector/commands/setInterpreter.unit.test.ts @@ -1052,6 +1052,7 @@ suite('Set Interpreter Command', () => { openLabel: InterpreterQuickPickList.browsePath.openButtonLabel, canSelectMany: false, title: InterpreterQuickPickList.browsePath.title, + defaultUri: undefined, }; const multiStepInput = TypeMoq.Mock.ofType>(); multiStepInput.setup((i) => i.showQuickPick(TypeMoq.It.isAny())).returns(() => Promise.resolve(items[0])); @@ -1073,6 +1074,27 @@ suite('Set Interpreter Command', () => { openLabel: InterpreterQuickPickList.browsePath.openButtonLabel, canSelectMany: false, title: InterpreterQuickPickList.browsePath.title, + defaultUri: undefined, + }; + multiStepInput.setup((i) => i.showQuickPick(TypeMoq.It.isAny())).returns(() => Promise.resolve(items[0])); + appShell.setup((a) => a.showOpenDialog(expectedParams)).verifiable(TypeMoq.Times.once()); + platformService.setup((p) => p.isWindows).returns(() => false); + + await setInterpreterCommand._enterOrBrowseInterpreterPath(multiStepInput.object, state).ignoreErrors(); + + appShell.verifyAll(); + }); + + test('If `Browse...` option is selected with workspace, file browser opens at workspace root', async () => { + const workspaceUri = Uri.parse('file:///workspace/root'); + const state: InterpreterStateArgs = { path: undefined, workspace: workspaceUri }; + const multiStepInput = TypeMoq.Mock.ofType>(); + const expectedParams = { + filters: undefined, + openLabel: InterpreterQuickPickList.browsePath.openButtonLabel, + canSelectMany: false, + title: InterpreterQuickPickList.browsePath.title, + defaultUri: workspaceUri, }; multiStepInput.setup((i) => i.showQuickPick(TypeMoq.It.isAny())).returns(() => Promise.resolve(items[0])); appShell.setup((a) => a.showOpenDialog(expectedParams)).verifiable(TypeMoq.Times.once()); @@ -1126,6 +1148,7 @@ suite('Set Interpreter Command', () => { openLabel: InterpreterQuickPickList.browsePath.openButtonLabel, canSelectMany: false, title: InterpreterQuickPickList.browsePath.title, + defaultUri: undefined, }; multiStepInput .setup((i) => i.showQuickPick(TypeMoq.It.isAny()))