Skip to content

Commit c794066

Browse files
test
Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
1 parent 9885282 commit c794066

1 file changed

Lines changed: 19 additions & 17 deletions

File tree

code/extensions/che-api/src/extension.ts

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,27 @@ import * as vscode from 'vscode';
2121
import { Api } from './api/api';
2222
import { DevfileService } from './api/devfile-service';
2323
import { K8SService } from './api/k8s-service';
24-
import { K8sDevfileServiceImpl } from './impl/k8s-devfile-service-impl';
25-
import { K8SServiceImpl } from './impl/k8s-service-impl';
26-
import { K8sDevWorkspaceEnvVariables } from './impl/k8s-devworkspace-env-variables';
2724
import { WorkspaceService } from './api/workspace-service';
28-
import { K8sWorkspaceServiceImpl } from './impl/k8s-workspace-service-impl';
2925
import { GithubService } from './api/github-service';
30-
import { GithubServiceImpl } from './impl/github-service-impl';
3126
import { TelemetryService } from './api/telemetry-service';
32-
import { K8sTelemetryServiceImpl } from './impl/k8s-telemetry-service-impl';
3327
import { Logger } from './logger';
3428

35-
3629
export async function activate(_extensionContext: vscode.ExtensionContext): Promise<Api> {
30+
const [
31+
{ K8sDevfileServiceImpl },
32+
{ K8SServiceImpl },
33+
{ K8sDevWorkspaceEnvVariables },
34+
{ K8sWorkspaceServiceImpl },
35+
{ GithubServiceImpl },
36+
{ K8sTelemetryServiceImpl },
37+
] = await Promise.all([
38+
import('./impl/k8s-devfile-service-impl'),
39+
import('./impl/k8s-service-impl'),
40+
import('./impl/k8s-devworkspace-env-variables'),
41+
import('./impl/k8s-workspace-service-impl'),
42+
import('./impl/github-service-impl'),
43+
import('./impl/k8s-telemetry-service-impl'),
44+
]);
3745

3846
const container = new Container();
3947
container.bind(K8sDevfileServiceImpl).toSelf().inSingletonScope();
@@ -47,22 +55,18 @@ export async function activate(_extensionContext: vscode.ExtensionContext): Prom
4755
container.bind(TelemetryService).to(K8sTelemetryServiceImpl).inSingletonScope();
4856
container.bind(Logger).toSelf().inSingletonScope();
4957

50-
const devfileService = container.get(DevfileService) as DevfileService;
51-
const workspaceService = container.get(WorkspaceService) as WorkspaceService;
52-
const githubService = container.get(GithubService) as GithubService;
53-
const telemetryService = container.get(TelemetryService) as TelemetryService;
5458
const api: Api = {
5559
getDevfileService(): DevfileService {
56-
return devfileService;
60+
return container.get(DevfileService) as DevfileService;
5761
},
5862
getWorkspaceService(): WorkspaceService {
59-
return workspaceService;
63+
return container.get(WorkspaceService) as WorkspaceService;
6064
},
6165
getGithubService(): GithubService {
62-
return githubService;
66+
return container.get(GithubService) as GithubService;
6367
},
6468
getTelemetryService(): TelemetryService {
65-
return telemetryService;
69+
return container.get(TelemetryService) as TelemetryService;
6670
},
6771
};
6872

@@ -77,7 +81,5 @@ export async function activate(_extensionContext: vscode.ExtensionContext): Prom
7781
_extensionContext.environmentVariableCollection.replace('WORKSPACE_NAMESPACE', workspaceNamespace);
7882
_extensionContext.environmentVariableCollection.replace('PROJECTS_ROOT', projectsRoot);
7983

80-
await container.get(K8SServiceImpl).ensureKubernetesServiceHostWhitelisted();
81-
8284
return api;
8385
}

0 commit comments

Comments
 (0)