@@ -8,23 +8,32 @@ import { IExtensionContext, Resource } from '../../common/types';
88import { commands , Uri , workspace } from 'vscode' ;
99import { getWorkspaceStateValue , updateWorkspaceStateValue } from '../../common/persistentState' ;
1010import { traceError } from '../../logging' ;
11+ import { IExtensionActivationService } from '../../activation/types' ;
12+ import { StopWatch } from '../../common/utils/stopWatch' ;
1113
1214const 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 {
0 commit comments