From 631523b170f2567e81785e5891eb02487938035d Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Tue, 12 Sep 2023 16:39:46 -0700 Subject: [PATCH 1/4] Fix `${command:python.interpreterPath}` in tasks.json in multiroot workspaces --- .../configuration/launch.json/interpreterPathCommand.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/debugger/extension/configuration/launch.json/interpreterPathCommand.ts b/src/client/debugger/extension/configuration/launch.json/interpreterPathCommand.ts index e4c14de407c9..21c8d0f1147b 100644 --- a/src/client/debugger/extension/configuration/launch.json/interpreterPathCommand.ts +++ b/src/client/debugger/extension/configuration/launch.json/interpreterPathCommand.ts @@ -41,7 +41,7 @@ export class InterpreterPathCommand implements IExtensionSingleActivationService let workspaceFolderUri; try { - workspaceFolderUri = workspaceFolder ? Uri.parse(workspaceFolder) : undefined; + workspaceFolderUri = workspaceFolder ? Uri.file(workspaceFolder) : undefined; } catch (ex) { workspaceFolderUri = undefined; } From 09bf3a3b9b9eaff6378e9d840e2912086dcd6694 Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Tue, 12 Sep 2023 16:53:25 -0700 Subject: [PATCH 2/4] Add unit test --- .../launch.json/interpreterPathCommand.unit.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/debugger/extension/configuration/launch.json/interpreterPathCommand.unit.test.ts b/src/test/debugger/extension/configuration/launch.json/interpreterPathCommand.unit.test.ts index c773e1cbd5bc..d1e38e5ed47b 100644 --- a/src/test/debugger/extension/configuration/launch.json/interpreterPathCommand.unit.test.ts +++ b/src/test/debugger/extension/configuration/launch.json/interpreterPathCommand.unit.test.ts @@ -56,7 +56,7 @@ suite('Interpreter Path Command', () => { test('If `args[1]` is defined, it is used to retrieve setting from config', async () => { const args = ['command', 'folderPath']; when(interpreterService.getActiveInterpreter(anything())).thenCall((arg) => { - assert.deepEqual(arg, Uri.parse('folderPath')); + assert.deepEqual(arg, Uri.file('folderPath')); return Promise.resolve({ path: 'settingValue' }) as unknown; }); From 18f159a0412024cfbeb1712d9df64978b2aa1d77 Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Tue, 12 Sep 2023 16:56:50 -0700 Subject: [PATCH 3/4] Fix --- .../launch.json/interpreterPathCommand.unit.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/debugger/extension/configuration/launch.json/interpreterPathCommand.unit.test.ts b/src/test/debugger/extension/configuration/launch.json/interpreterPathCommand.unit.test.ts index d1e38e5ed47b..dc8d4d8dafdf 100644 --- a/src/test/debugger/extension/configuration/launch.json/interpreterPathCommand.unit.test.ts +++ b/src/test/debugger/extension/configuration/launch.json/interpreterPathCommand.unit.test.ts @@ -45,7 +45,7 @@ suite('Interpreter Path Command', () => { test('If `workspaceFolder` property exists in `args`, it is used to retrieve setting from config', async () => { const args = { workspaceFolder: 'folderPath' }; when(interpreterService.getActiveInterpreter(anything())).thenCall((arg) => { - assert.deepEqual(arg, Uri.parse('folderPath')); + assert.deepEqual(arg, Uri.file('folderPath')); return Promise.resolve({ path: 'settingValue' }) as unknown; }); From 65af05b29294461834743216fdeab7858f38e0cb Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Tue, 12 Sep 2023 16:59:14 -0700 Subject: [PATCH 4/4] Remove --- .../launch.json/interpreterPathCommand.unit.test.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/test/debugger/extension/configuration/launch.json/interpreterPathCommand.unit.test.ts b/src/test/debugger/extension/configuration/launch.json/interpreterPathCommand.unit.test.ts index dc8d4d8dafdf..77077ad945fb 100644 --- a/src/test/debugger/extension/configuration/launch.json/interpreterPathCommand.unit.test.ts +++ b/src/test/debugger/extension/configuration/launch.json/interpreterPathCommand.unit.test.ts @@ -73,14 +73,4 @@ suite('Interpreter Path Command', () => { const setting = await interpreterPathCommand._getSelectedInterpreterPath(args); expect(setting).to.equal('settingValue'); }); - - test('If `args[1]` is not a valid uri', async () => { - const args = ['command', '${input:some_input}']; - when(interpreterService.getActiveInterpreter(anything())).thenCall((arg) => { - assert.deepEqual(arg, undefined); - return Promise.resolve({ path: 'settingValue' }) as unknown; - }); - const setting = await interpreterPathCommand._getSelectedInterpreterPath(args); - expect(setting).to.equal('settingValue'); - }); });