Skip to content

Commit 9ebc5eb

Browse files
author
Kartik Raj
authored
Fix ${command:python.interpreterPath} in tasks.json in multiroot workspaces (#21980)
Closes #21915
1 parent 2268d53 commit 9ebc5eb

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

src/client/debugger/extension/configuration/launch.json/interpreterPathCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class InterpreterPathCommand implements IExtensionSingleActivationService
4141

4242
let workspaceFolderUri;
4343
try {
44-
workspaceFolderUri = workspaceFolder ? Uri.parse(workspaceFolder) : undefined;
44+
workspaceFolderUri = workspaceFolder ? Uri.file(workspaceFolder) : undefined;
4545
} catch (ex) {
4646
workspaceFolderUri = undefined;
4747
}

src/test/debugger/extension/configuration/launch.json/interpreterPathCommand.unit.test.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ suite('Interpreter Path Command', () => {
4545
test('If `workspaceFolder` property exists in `args`, it is used to retrieve setting from config', async () => {
4646
const args = { workspaceFolder: 'folderPath' };
4747
when(interpreterService.getActiveInterpreter(anything())).thenCall((arg) => {
48-
assert.deepEqual(arg, Uri.parse('folderPath'));
48+
assert.deepEqual(arg, Uri.file('folderPath'));
4949

5050
return Promise.resolve({ path: 'settingValue' }) as unknown;
5151
});
@@ -56,7 +56,7 @@ suite('Interpreter Path Command', () => {
5656
test('If `args[1]` is defined, it is used to retrieve setting from config', async () => {
5757
const args = ['command', 'folderPath'];
5858
when(interpreterService.getActiveInterpreter(anything())).thenCall((arg) => {
59-
assert.deepEqual(arg, Uri.parse('folderPath'));
59+
assert.deepEqual(arg, Uri.file('folderPath'));
6060

6161
return Promise.resolve({ path: 'settingValue' }) as unknown;
6262
});
@@ -73,14 +73,4 @@ suite('Interpreter Path Command', () => {
7373
const setting = await interpreterPathCommand._getSelectedInterpreterPath(args);
7474
expect(setting).to.equal('settingValue');
7575
});
76-
77-
test('If `args[1]` is not a valid uri', async () => {
78-
const args = ['command', '${input:some_input}'];
79-
when(interpreterService.getActiveInterpreter(anything())).thenCall((arg) => {
80-
assert.deepEqual(arg, undefined);
81-
return Promise.resolve({ path: 'settingValue' }) as unknown;
82-
});
83-
const setting = await interpreterPathCommand._getSelectedInterpreterPath(args);
84-
expect(setting).to.equal('settingValue');
85-
});
8676
});

0 commit comments

Comments
 (0)