import { ExtensionContext , tasks , Uri , workspace } from "vscode" ; import { dispose as disposeTelemetryWrapper , initializeFromJsonFile , instrumentOperation , sendInfo } from "vscode-extension-telemetry-wrapper" ; import { contextManager } from "../extension.bundle" ; import { Context } from "./constants" ; import { LibraryController } from "./controllers/libraryController" ; import { ProjectController } from "./controllers/projectController" ; import { init as initExpService } from "./ExperimentationService" ; import { ExportJarTaskProvider } from "./exportJarSteps/ExportJarTaskProvider" ; import { languageServerApiManager } from "./languageServerApi/languageServerApiManager" ; import { Settings } from "./settings" ; import { syncHandler } from "./syncHandler" ; import { EventCounter } from "./utility" ; import { DependencyExplorer } from "./views/dependencyExplorer" ; export async function activate ( context ) { contextManager . initialize ( context ) ; await initializeFromJsonFile ( context . asAbsolutePath ( "./package.json" ) , { firstParty : true } ) ; await initExpService ( context ) ; await instrumentOperation ( "activation" , activateExtension ) ( context ) ; languageServerApiManager . initializeJavaLanguageServerApi ( false ) ; workspace . findFiles ( "{*.gradle,*.gradle.kts,pom.xml,.classpath}" , undefined , 1 ) . then ( ( uris ) => { if ( uris && uris . length ) { contextManager . setContextValue ( Context . WORKSPACE_CONTAINS_BUILD_FILES , true ) ; } } ) ; contextManager . setContextValue ( Context . EXTENSION_ACTIVATED , true ) ; } async function activateExtension ( _operationId , context ) { context . subscriptions . push ( languageServerApiManager ) ; context . subscriptions . push ( new ProjectController ( context ) ) ; Settings . initialize ( context ) ; context . subscriptions . push ( new LibraryController ( context ) ) ; context . subscriptions . push ( DependencyExplorer . getInstance ( context ) ) ; context . subscriptions . push ( contextManager ) ; context . subscriptions . push ( syncHandler ) ; context . subscriptions . push ( tasks . registerTaskProvider ( ExportJarTaskProvider . exportJarType , new ExportJarTaskProvider ( ) ) ) ; } export async function deactivate ( ) { sendInfo ( "" , EventCounter . dict ) ; await disposeTelemetryWrapper ( ) ; }