Skip to content

Commit 79e410e

Browse files
committed
fix(vscode): improve handling of active environment path changes in PythonManager
1 parent 034cf3f commit 79e410e

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

vscode-client/extension/pythonmanger.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,16 @@ export class PythonManager {
7070
}
7171

7272
private doActiveEnvironmentPathChanged(event: ActiveEnvironmentPathChangeEvent): void {
73-
this.outputChannel.appendLine(
74-
`ActiveEnvironmentPathChanged: ${event.resource?.uri.toString() ?? UNKNOWN} ${event.id}`,
75-
);
76-
this._onActivePythonEnvironmentChangedEmitter.fire({ resource: event.resource });
73+
const wsFolder =
74+
event.resource === undefined
75+
? undefined
76+
: event.resource instanceof vscode.Uri
77+
? vscode.workspace.getWorkspaceFolder(event.resource)
78+
: event.resource;
79+
80+
this.outputChannel.appendLine(`ActiveEnvironmentPathChanged: ${wsFolder?.uri ?? UNKNOWN} ${event.id}`);
81+
82+
this._onActivePythonEnvironmentChangedEmitter.fire({ resource: wsFolder });
7783
}
7884

7985
async getPythonExtension(): Promise<PythonExtension | undefined> {

0 commit comments

Comments
 (0)