'use strict' ; if ( ( Reflect as any ) . metadata === undefined ) { require ( 'reflect-metadata' ) ; } import { Container } from 'inversify' ; import { debug , Disposable , ExtensionContext , OutputChannel , window } from 'vscode' ; import { ApplicationName } from './common/constants' ; import { registerTypes as platformRegisterTypes } from './common/platform/serviceRegistry' ; import { registerTypes as processRegisterTypes } from './common/process/serviceRegistry' ; import { registerTypes as commonRegisterTypes } from './common/serviceRegistry' ; import { IDisposableRegistry , IOutputChannel } from './common/types' ; import { registerTypes as cookiecutterRegisterTypes } from './cookieCutter/serviceRegistry' ; import { registerTypes as debugRegisterTypes } from './debugger/serviceRegistry' ; import { IDebugConfigurationProvider } from './debugger/types' ; import { ServiceContainer } from './ioc/container' ; import { ServiceManager } from './ioc/serviceManager' ; import { IServiceContainer } from './ioc/types' ; import { registerTypes as projectRegisterTypes } from './project/serviceRegistry' ; import { IProjectCommand } from './project/types' ; import { registerTypes as taskRegisterTypes } from './tasks/serviceRegistry' ; import { ITaskCommands } from './tasks/types' ; import { registerTypes as templatesRegisterTypes } from './templates/serviceRegistry' ; export function activate ( context ) { const cont = new Container ( ) ; const serviceManager = new ServiceManager ( cont ) ; const serviceContainer = new ServiceContainer ( cont ) ; registerServices ( context , serviceManager , serviceContainer ) ; initialize ( serviceContainer ) ; } function registerServices ( context , serviceManager , serviceContainer ) { serviceManager . addSingletonInstance < IServiceContainer > ( IServiceContainer , serviceContainer ) ; serviceManager . addSingletonInstance < Disposable [ ] > ( IDisposableRegistry , context . subscriptions ) ; const outputChannel = window . createOutputChannel ( ApplicationName ) ; context . subscriptions . push ( outputChannel ) ; serviceManager . addSingletonInstance < OutputChannel > ( IOutputChannel , outputChannel ) ; commonRegisterTypes ( serviceManager ) ; platformRegisterTypes ( serviceManager ) ; processRegisterTypes ( serviceManager ) ; cookiecutterRegisterTypes ( serviceManager ) ; templatesRegisterTypes ( serviceManager ) ; projectRegisterTypes ( serviceManager ) ; taskRegisterTypes ( serviceManager ) ; debugRegisterTypes ( serviceManager ) ; const debugConfigProvider = serviceManager . get < IDebugConfigurationProvider > ( IDebugConfigurationProvider ) ; context . subscriptions . push ( debug . registerDebugConfigurationProvider ( 'beeware' , debugConfigProvider ) ) ; } function initialize ( serviceContainer ) { serviceContainer . get < IProjectCommand > ( IProjectCommand ) . register ( ) ; serviceContainer . get < ITaskCommands > ( ITaskCommands ) . register ( ) ; }