forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathserviceRegistry.ts
More file actions
122 lines (109 loc) · 5.82 KB
/
serviceRegistry.ts
File metadata and controls
122 lines (109 loc) · 5.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
import { IExtensionActivationService, IExtensionSingleActivationService } from '../activation/types';
import { IServiceManager } from '../ioc/types';
import { EnvironmentActivationService } from './activation/service';
import { IEnvironmentActivationService } from './activation/types';
import { InterpreterAutoSelectionService } from './autoSelection/index';
import { InterpreterAutoSelectionProxyService } from './autoSelection/proxy';
import { IInterpreterAutoSelectionService, IInterpreterAutoSelectionProxyService } from './autoSelection/types';
import { EnvironmentTypeComparer } from './configuration/environmentTypeComparer';
import { InstallPythonCommand } from './configuration/interpreterSelector/commands/installPython';
import { InstallPythonViaTerminal } from './configuration/interpreterSelector/commands/installPython/installPythonViaTerminal';
import { ResetInterpreterCommand } from './configuration/interpreterSelector/commands/resetInterpreter';
import { SetInterpreterCommand } from './configuration/interpreterSelector/commands/setInterpreter';
import { InterpreterSelector } from './configuration/interpreterSelector/interpreterSelector';
import { RecommendedEnvironmentService } from './configuration/recommededEnvironmentService';
import { PythonPathUpdaterService } from './configuration/pythonPathUpdaterService';
import { PythonPathUpdaterServiceFactory } from './configuration/pythonPathUpdaterServiceFactory';
import {
IInterpreterComparer,
IInterpreterQuickPick,
IInterpreterSelector,
IRecommendedEnvironmentService,
IPythonPathUpdaterServiceFactory,
IPythonPathUpdaterServiceManager,
} from './configuration/types';
import { IActivatedEnvironmentLaunch, IInterpreterDisplay, IInterpreterHelper, IInterpreterService } from './contracts';
import { InterpreterDisplay } from './display';
import { InterpreterLocatorProgressStatusBarHandler } from './display/progressDisplay';
import { InterpreterHelper } from './helpers';
import { InterpreterPathCommand } from './interpreterPathCommand';
import { InterpreterService } from './interpreterService';
import { ActivatedEnvironmentLaunch } from './virtualEnvs/activatedEnvLaunch';
import { CondaInheritEnvPrompt } from './virtualEnvs/condaInheritEnvPrompt';
import { VirtualEnvironmentPrompt } from './virtualEnvs/virtualEnvPrompt';
/**
* Register all the new types inside this method.
* This method is created for testing purposes. Registers all interpreter types except `IInterpreterAutoSelectionProxyService`, `IEnvironmentActivationService`.
* See use case in `src\test\serviceRegistry.ts` for details
* @param serviceManager
*/
export function registerInterpreterTypes(serviceManager: IServiceManager): void {
serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSingleActivationService,
InstallPythonCommand,
);
serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSingleActivationService,
InstallPythonViaTerminal,
);
serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSingleActivationService,
SetInterpreterCommand,
);
serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSingleActivationService,
ResetInterpreterCommand,
);
serviceManager.addSingleton<IRecommendedEnvironmentService>(
IRecommendedEnvironmentService,
RecommendedEnvironmentService,
);
serviceManager.addSingleton(IInterpreterQuickPick, SetInterpreterCommand);
serviceManager.addSingleton<IExtensionActivationService>(IExtensionActivationService, VirtualEnvironmentPrompt);
serviceManager.addSingleton<IInterpreterService>(IInterpreterService, InterpreterService);
serviceManager.addSingleton<IInterpreterDisplay>(IInterpreterDisplay, InterpreterDisplay);
serviceManager.addBinding(IInterpreterDisplay, IExtensionSingleActivationService);
serviceManager.addSingleton<IPythonPathUpdaterServiceFactory>(
IPythonPathUpdaterServiceFactory,
PythonPathUpdaterServiceFactory,
);
serviceManager.addSingleton<IPythonPathUpdaterServiceManager>(
IPythonPathUpdaterServiceManager,
PythonPathUpdaterService,
);
serviceManager.addSingleton<IInterpreterSelector>(IInterpreterSelector, InterpreterSelector);
serviceManager.addSingleton<IInterpreterHelper>(IInterpreterHelper, InterpreterHelper);
serviceManager.addSingleton<IInterpreterComparer>(IInterpreterComparer, EnvironmentTypeComparer);
serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSingleActivationService,
InterpreterLocatorProgressStatusBarHandler,
);
serviceManager.addSingleton<IInterpreterAutoSelectionService>(
IInterpreterAutoSelectionService,
InterpreterAutoSelectionService,
);
serviceManager.addSingleton<IExtensionActivationService>(IExtensionActivationService, CondaInheritEnvPrompt);
serviceManager.addSingleton<IActivatedEnvironmentLaunch>(IActivatedEnvironmentLaunch, ActivatedEnvironmentLaunch);
}
export function registerTypes(serviceManager: IServiceManager): void {
registerInterpreterTypes(serviceManager);
serviceManager.addSingleton<IInterpreterAutoSelectionProxyService>(
IInterpreterAutoSelectionProxyService,
InterpreterAutoSelectionProxyService,
);
serviceManager.addSingleton<IEnvironmentActivationService>(
EnvironmentActivationService,
EnvironmentActivationService,
);
serviceManager.addSingleton<IEnvironmentActivationService>(
IEnvironmentActivationService,
EnvironmentActivationService,
);
serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSingleActivationService,
InterpreterPathCommand,
);
}