@@ -8,23 +8,32 @@ import { IExtensionContext, Resource } from '../../common/types';
8
8
import { commands , Uri , workspace } from 'vscode' ;
9
9
import { getWorkspaceStateValue , updateWorkspaceStateValue } from '../../common/persistentState' ;
10
10
import { traceError } from '../../logging' ;
11
+ import { IExtensionActivationService } from '../../activation/types' ;
12
+ import { StopWatch } from '../../common/utils/stopWatch' ;
11
13
12
14
const MEMENTO_KEY = 'userSelectedEnvPath' ;
13
15
14
16
@injectable ( )
15
- export class RecommendedEnvironmentService implements IRecommendedEnvironmentService {
17
+ export class RecommendedEnvironmentService implements IRecommendedEnvironmentService , IExtensionActivationService {
16
18
private api ?: PythonExtension [ 'environments' ] ;
17
19
constructor ( @inject ( IExtensionContext ) private readonly extensionContext : IExtensionContext ) { }
20
+ supportedWorkspaceTypes : { untrustedWorkspace : boolean ; virtualWorkspace : boolean } = {
21
+ untrustedWorkspace : true ,
22
+ virtualWorkspace : false ,
23
+ } ;
18
24
19
- registerEnvApi ( api : PythonExtension [ 'environments' ] ) {
20
- this . api = api ;
25
+ async activate ( _resource : Resource , _startupStopWatch ?: StopWatch ) : Promise < void > {
21
26
this . extensionContext . subscriptions . push (
22
27
commands . registerCommand ( 'python.getRecommendedEnvironment' , async ( resource : Resource ) => {
23
28
return this . getRecommededEnvironment ( resource ) ;
24
29
} ) ,
25
30
) ;
26
31
}
27
32
33
+ registerEnvApi ( api : PythonExtension [ 'environments' ] ) {
34
+ this . api = api ;
35
+ }
36
+
28
37
trackUserSelectedEnvironment ( environmentPath : string | undefined , uri : Uri | undefined ) {
29
38
if ( workspace . workspaceFolders ?. length ) {
30
39
try {
0 commit comments