Skip to content

Commit fdaec71

Browse files
committed
Updatges
1 parent 2fe163e commit fdaec71

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/client/interpreter/configuration/recommededEnvironmentService.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,32 @@ import { IExtensionContext, Resource } from '../../common/types';
88
import { commands, Uri, workspace } from 'vscode';
99
import { getWorkspaceStateValue, updateWorkspaceStateValue } from '../../common/persistentState';
1010
import { traceError } from '../../logging';
11+
import { IExtensionActivationService } from '../../activation/types';
12+
import { StopWatch } from '../../common/utils/stopWatch';
1113

1214
const MEMENTO_KEY = 'userSelectedEnvPath';
1315

1416
@injectable()
15-
export class RecommendedEnvironmentService implements IRecommendedEnvironmentService {
17+
export class RecommendedEnvironmentService implements IRecommendedEnvironmentService, IExtensionActivationService {
1618
private api?: PythonExtension['environments'];
1719
constructor(@inject(IExtensionContext) private readonly extensionContext: IExtensionContext) {}
20+
supportedWorkspaceTypes: { untrustedWorkspace: boolean; virtualWorkspace: boolean } = {
21+
untrustedWorkspace: true,
22+
virtualWorkspace: false,
23+
};
1824

19-
registerEnvApi(api: PythonExtension['environments']) {
20-
this.api = api;
25+
async activate(_resource: Resource, _startupStopWatch?: StopWatch): Promise<void> {
2126
this.extensionContext.subscriptions.push(
2227
commands.registerCommand('python.getRecommendedEnvironment', async (resource: Resource) => {
2328
return this.getRecommededEnvironment(resource);
2429
}),
2530
);
2631
}
2732

33+
registerEnvApi(api: PythonExtension['environments']) {
34+
this.api = api;
35+
}
36+
2837
trackUserSelectedEnvironment(environmentPath: string | undefined, uri: Uri | undefined) {
2938
if (workspace.workspaceFolders?.length) {
3039
try {

src/client/interpreter/serviceRegistry.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export function registerInterpreterTypes(serviceManager: IServiceManager): void
6565
IRecommendedEnvironmentService,
6666
RecommendedEnvironmentService,
6767
);
68+
serviceManager.addBinding(IRecommendedEnvironmentService, IExtensionActivationService);
6869
serviceManager.addSingleton(IInterpreterQuickPick, SetInterpreterCommand);
6970

7071
serviceManager.addSingleton<IExtensionActivationService>(IExtensionActivationService, VirtualEnvironmentPrompt);

0 commit comments

Comments
 (0)