"use strict" ; import { commands , ExtensionContext , languages } from "vscode" ; import { Fixer } from "./fixer" ; import { Logger } from "./logger" ; import { Sniffer } from "./sniffer" ; import { Configuration } from "./configuration" ; import { Settings } from "./interfaces/settings" ; const extensionName = process . env . EXTENSION_NAME || "dev.prettier-vscode" ; const extensionVersion = process . env . EXTENSION_VERSION || "0.0.0" ; function activateFixer ( context , settings , logger ) { const fixer = new Fixer ( context . subscriptions , settings , logger ) ; context . subscriptions . push ( commands . registerTextEditorCommand ( "fixer.fix" , ( textEditor ) => { if ( textEditor . document . languageId === "php" ) { commands . executeCommand ( "editor.action.formatDocument" ) ; } } ) ) ; context . subscriptions . push ( languages . registerDocumentRangeFormattingEditProvider ( { scheme : "file" , language : "php" } , { provideDocumentRangeFormattingEdits : ( document , range ) => { return fixer . registerDocumentProvider ( document , range ) ; } , } ) ) ; } function activateSniffer ( context , settings , logger ) { const sniffer = new Sniffer ( context . subscriptions , settings , logger ) ; context . subscriptions . push ( sniffer ) ; } param context export async function activate ( context ) { const logger = new Logger ( ) ; logger . logInfo ( `Extension Name: ${ extensionName }.` ) ; logger . logInfo ( `Extension Version: ${ extensionVersion }.` ) ; const configuration = new Configuration ( logger ) ; const settings = await configuration . load ( ) ; activateFixer ( context , settings , logger ) ; activateSniffer ( context , settings , logger ) ; }