forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlegacyIOC.ts
More file actions
136 lines (131 loc) · 6.19 KB
/
legacyIOC.ts
File metadata and controls
136 lines (131 loc) · 6.19 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import {
CONDA_ENV_FILE_SERVICE,
CONDA_ENV_SERVICE,
CURRENT_PATH_SERVICE,
GLOBAL_VIRTUAL_ENV_SERVICE,
ICondaService,
IInterpreterLocatorHelper,
IInterpreterLocatorProgressService,
IInterpreterLocatorService,
IInterpreterWatcher,
IInterpreterWatcherBuilder,
IKnownSearchPathsForInterpreters,
INTERPRETER_LOCATOR_SERVICE,
IVirtualEnvironmentsSearchPathProvider,
KNOWN_PATH_SERVICE,
PIPENV_SERVICE,
WINDOWS_REGISTRY_SERVICE,
WORKSPACE_VIRTUAL_ENV_SERVICE,
} from '../interpreter/contracts';
import { IPipEnvServiceHelper, IPythonInPathCommandProvider } from '../interpreter/locators/types';
import { IServiceContainer, IServiceManager } from '../ioc/types';
import { initializeExternalDependencies } from './common/externalDependencies';
import { PythonInterpreterLocatorService } from './discovery/locators';
import { InterpreterLocatorHelper } from './discovery/locators/helpers';
import { InterpreterLocatorProgressService } from './discovery/locators/progressService';
import { CondaEnvFileService } from './discovery/locators/services/condaEnvFileService';
import { CondaEnvService } from './discovery/locators/services/condaEnvService';
import { CondaService } from './discovery/locators/services/condaService';
import { CurrentPathService, PythonInPathCommandProvider } from './discovery/locators/services/currentPathService';
import {
GlobalVirtualEnvironmentsSearchPathProvider,
GlobalVirtualEnvService,
} from './discovery/locators/services/globalVirtualEnvService';
import { InterpreterHashProvider } from './discovery/locators/services/hashProvider';
import { InterpeterHashProviderFactory } from './discovery/locators/services/hashProviderFactory';
import { InterpreterWatcherBuilder } from './discovery/locators/services/interpreterWatcherBuilder';
import { KnownPathsService, KnownSearchPathsForInterpreters } from './discovery/locators/services/KnownPathsService';
import { PipEnvService } from './discovery/locators/services/pipEnvService';
import { PipEnvServiceHelper } from './discovery/locators/services/pipEnvServiceHelper';
import { WindowsRegistryService } from './discovery/locators/services/windowsRegistryService';
import { WindowsStoreInterpreter } from './discovery/locators/services/windowsStoreInterpreter';
import {
WorkspaceVirtualEnvironmentsSearchPathProvider,
WorkspaceVirtualEnvService,
} from './discovery/locators/services/workspaceVirtualEnvService';
import { WorkspaceVirtualEnvWatcherService } from './discovery/locators/services/workspaceVirtualEnvWatcherService';
import { EnvironmentInfoService, IEnvironmentInfoService } from './info/environmentInfoService';
export function registerForIOC(serviceManager: IServiceManager, serviceContainer: IServiceContainer): void {
serviceManager.addSingleton<IInterpreterLocatorHelper>(IInterpreterLocatorHelper, InterpreterLocatorHelper);
serviceManager.addSingleton<IInterpreterLocatorService>(
IInterpreterLocatorService,
PythonInterpreterLocatorService,
INTERPRETER_LOCATOR_SERVICE,
);
serviceManager.addSingleton<IInterpreterLocatorProgressService>(
IInterpreterLocatorProgressService,
InterpreterLocatorProgressService,
);
serviceManager.addSingleton<IInterpreterLocatorService>(
IInterpreterLocatorService,
CondaEnvFileService,
CONDA_ENV_FILE_SERVICE,
);
serviceManager.addSingleton<IInterpreterLocatorService>(
IInterpreterLocatorService,
CondaEnvService,
CONDA_ENV_SERVICE,
);
serviceManager.addSingleton<IInterpreterLocatorService>(
IInterpreterLocatorService,
CurrentPathService,
CURRENT_PATH_SERVICE,
);
serviceManager.addSingleton<IInterpreterLocatorService>(
IInterpreterLocatorService,
GlobalVirtualEnvService,
GLOBAL_VIRTUAL_ENV_SERVICE,
);
serviceManager.addSingleton<IInterpreterLocatorService>(
IInterpreterLocatorService,
WorkspaceVirtualEnvService,
WORKSPACE_VIRTUAL_ENV_SERVICE,
);
serviceManager.addSingleton<IInterpreterLocatorService>(IInterpreterLocatorService, PipEnvService, PIPENV_SERVICE);
serviceManager.addSingleton<IInterpreterLocatorService>(
IInterpreterLocatorService,
WindowsRegistryService,
WINDOWS_REGISTRY_SERVICE,
);
serviceManager.addSingleton<IInterpreterLocatorService>(
IInterpreterLocatorService,
KnownPathsService,
KNOWN_PATH_SERVICE,
);
serviceManager.addSingleton<ICondaService>(ICondaService, CondaService);
serviceManager.addSingleton<IPipEnvServiceHelper>(IPipEnvServiceHelper, PipEnvServiceHelper);
serviceManager.addSingleton<IPythonInPathCommandProvider>(
IPythonInPathCommandProvider,
PythonInPathCommandProvider,
);
serviceManager.add<IInterpreterWatcher>(
IInterpreterWatcher,
WorkspaceVirtualEnvWatcherService,
WORKSPACE_VIRTUAL_ENV_SERVICE,
);
serviceManager.addSingleton<WindowsStoreInterpreter>(WindowsStoreInterpreter, WindowsStoreInterpreter);
serviceManager.addSingleton<InterpreterHashProvider>(InterpreterHashProvider, InterpreterHashProvider);
serviceManager.addSingleton<InterpeterHashProviderFactory>(
InterpeterHashProviderFactory,
InterpeterHashProviderFactory,
);
serviceManager.addSingleton<IVirtualEnvironmentsSearchPathProvider>(
IVirtualEnvironmentsSearchPathProvider,
GlobalVirtualEnvironmentsSearchPathProvider,
'global',
);
serviceManager.addSingleton<IVirtualEnvironmentsSearchPathProvider>(
IVirtualEnvironmentsSearchPathProvider,
WorkspaceVirtualEnvironmentsSearchPathProvider,
'workspace',
);
serviceManager.addSingleton<IKnownSearchPathsForInterpreters>(
IKnownSearchPathsForInterpreters,
KnownSearchPathsForInterpreters,
);
serviceManager.addSingleton<IInterpreterWatcherBuilder>(IInterpreterWatcherBuilder, InterpreterWatcherBuilder);
serviceManager.addSingletonInstance<IEnvironmentInfoService>(IEnvironmentInfoService, new EnvironmentInfoService());
initializeExternalDependencies(serviceContainer);
}