Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/client/common/vscodeApis/workspaceApis.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import { ConfigurationScope, workspace, WorkspaceConfiguration, WorkspaceFolder } from 'vscode';
import { ConfigurationScope, Uri, workspace, WorkspaceConfiguration, WorkspaceFolder } from 'vscode';

export function getWorkspaceFolder(resource: Uri | undefined): WorkspaceFolder | undefined {
return resource ? workspace.getWorkspaceFolder(resource) : resource;
}

export function getWorkspaceFolders(): readonly WorkspaceFolder[] | undefined {
return workspace.workspaceFolders;
Expand Down
3 changes: 2 additions & 1 deletion src/client/proposedApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
import { DeprecatedProposedAPI } from './deprecatedProposedApiTypes';
import { IEnvironmentVariablesProvider } from './common/variables/types';
import { IWorkspaceService } from './common/application/types';
import { getWorkspaceFolder } from './common/vscodeApis/workspaceApis';

type ActiveEnvironmentChangeEvent = {
resource: WorkspaceFolder | undefined;
Expand Down Expand Up @@ -280,7 +281,7 @@ export function convertCompleteEnvInfo(env: PythonEnvInfo): ResolvedEnvironment
type: convertEnvType(env.type),
name: env.name,
folderUri: Uri.file(env.location),
workspaceFolder: env.searchLocation,
workspaceFolder: getWorkspaceFolder(env.searchLocation)?.uri,
}
: undefined,
version: version as ResolvedEnvironment['version'],
Expand Down