forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
Milestone
Description
Refs: #18357
- anyOS: @rchiodo
- anyOS: @DonJayamanne
Complexity: 3
Requirements
Tagging the team who previously tested #18348.
- Use pre release build of the python extension.
- Context: Multiple environments can now share the same interpreter path with Support discovering multiple conda envs with same interpreter path #18357, so interpreter path can no longer be considered as the key. For envs lacking an interpreter, path to environment folder is now considered as key, and the following type is returned via the API:
vscode-python/src/client/pythonEnvironments/base/info/index.ts
Lines 31 to 39 in f1d0509
| export interface EnvPathType { | |
| /** | |
| * Path to environment folder or path to interpreter that uniquely identifies an environment. | |
| * Virtual environments lacking an interpreter are identified by environment folder paths, | |
| * whereas other envs can be identified using interpreter path. | |
| */ | |
| path: string; | |
| pathType: 'envFolderPath' | 'interpreterPath'; | |
| } |
Test APIs exposed via IProposedExtensionAPI
- Create two conda environments without python:
conda create -n test1
conda create -n test2
We want to make sure these can be discovered and selected.
-
Check https://github.com/microsoft/vscode-python/pull/18427/files#diff-5dd4c66e9be787a2f10dad4947293e8c303251166e40f553edc743b336db5b75 for the updates made to the API.
-
See
IProposedExtensionAPIfor APIs to test.vscode-python/src/client/apiTypes.ts
Line 127 in f1d0509
export interface IProposedExtensionAPI {
Example usage:
Copy over contents of https://github.com/microsoft/vscode-python/blob/main/src/client/apiTypes.ts as needed.
const extension = extensions.getExtension('ms-python.python');
if (extension) {
if (!extension.isActive) {
await extension.activate();
}
const api: IExtensionApi & IProposedExtensionAPI = extension.exports as IExtensionApi & IProposedExtensionAPI;
if (api.environment) {
interpreterPath = await api.environment.getActiveEnvironmentPath();
}
}