/// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            var dte = (DTE)GetService(typeof(DTE));

            var txtMgr = (IVsTextManager)GetService(typeof(SVsTextManager));
            var runningDocumentTable = new RunningDocumentTable(this);
            var documentFormatter = new DocumentFormatter(txtMgr, dte);
            plugin = new FormatDocumentOnBeforeSave(dte, runningDocumentTable, documentFormatter);
            runningDocumentTable.Advise(plugin);

            base.Initialize();
        }
 public FormatDocumentOnBeforeSave(DTE dte, RunningDocumentTable runningDocumentTable, DocumentFormatter documentFormatter)
 {
     _runningDocumentTable = runningDocumentTable;
     _documentFormatter = documentFormatter;
     _dte = dte;
 }