Skip to content

Commit f73a671

Browse files
committed
Revert "Ensure relative paths to interpreters are prefixed with './' in settings.json (#2750)"
Turns out that on Windows the added `.` gets dropped, partially negating any benefit of having this. Reverting to keep things consistent across operating systems. This reverts commit 56f1fd1.
1 parent 0eba0a6 commit f73a671

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

news/2 Fixes/2744.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/client/interpreter/configuration/services/workspaceFolderUpdaterService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class WorkspaceFolderPythonPathUpdaterService implements IPythonPathUpdat
1414
return;
1515
}
1616
if (pythonPath.startsWith(this.workspaceFolder.fsPath)) {
17-
pythonPath = path.join('.', path.relative(this.workspaceFolder.fsPath, pythonPath));
17+
pythonPath = path.relative(this.workspaceFolder.fsPath, pythonPath);
1818
}
1919
await pythonConfig.update('pythonPath', pythonPath, ConfigurationTarget.WorkspaceFolder);
2020
}

src/client/interpreter/configuration/services/workspaceUpdaterService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class WorkspacePythonPathUpdaterService implements IPythonPathUpdaterServ
1414
return;
1515
}
1616
if (pythonPath.startsWith(this.workspace.fsPath)) {
17-
pythonPath = path.join('.', path.relative(this.workspace.fsPath, pythonPath));
17+
pythonPath = path.relative(this.workspace.fsPath, pythonPath);
1818
}
1919
await pythonConfig.update('pythonPath', pythonPath, false);
2020
}

src/test/interpreters/pythonPathUpdater.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ suite('Python Path Settings Updater', () => {
8080
const workspaceFolder = Uri.file(workspaceFolderPath);
8181
const updater = updaterServiceFactory.getWorkspaceFolderPythonPathConfigurationService(workspaceFolder);
8282
const pythonPath = Uri.file(path.join(workspaceFolderPath, 'env', 'bin', 'python')).fsPath;
83-
const expectedPythonPath = path.join('.', 'env', 'bin', 'python');
83+
const expectedPythonPath = path.join('env', 'bin', 'python');
8484
const workspaceConfig = setupConfigProvider(workspaceFolder);
8585
workspaceConfig.setup(w => w.inspect(TypeMoq.It.isValue('pythonPath'))).returns(() => undefined);
8686

@@ -120,7 +120,7 @@ suite('Python Path Settings Updater', () => {
120120
const workspaceFolder = Uri.file(workspaceFolderPath);
121121
const updater = updaterServiceFactory.getWorkspacePythonPathConfigurationService(workspaceFolder);
122122
const pythonPath = Uri.file(path.join(workspaceFolderPath, 'env', 'bin', 'python')).fsPath;
123-
const expectedPythonPath = path.join('.', 'env', 'bin', 'python');
123+
const expectedPythonPath = path.join('env', 'bin', 'python');
124124
const workspaceConfig = setupConfigProvider(workspaceFolder);
125125
workspaceConfig.setup(w => w.inspect(TypeMoq.It.isValue('pythonPath'))).returns(() => undefined);
126126

0 commit comments

Comments
 (0)