private void FormatByDaxFormatter(DaxFormatterCom.FormattingCulture formattingCulture)
        {
            string originalText = _source.GetText(_formattingSpan);

            if (!string.IsNullOrEmpty(originalText))
            {
                try
                {
                    var formattedText = DaxFormatterCom.Format(originalText, formattingCulture);
                    _editManager.Add(new EditSpan(_formattingSpan, formattedText));
                }
                catch (Exception e)
                {
                    DaxEditorPackage.WriteToGeneral(e.Message);
                    System.Windows.MessageBox.Show(e.Message, "Exception from daxformatter.com", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
                }
            }
        }
        /////////////////////////////////////////////////////////////////////////////
        // Overriden Package Implementation
        #region Package Members

        /// <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 initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            _languageService = new Babel.LanguageService();
            _languageService.SetSite(this);

            IServiceContainer serviceContainter = (IServiceContainer)this;

            serviceContainter.AddService(typeof(Babel.LanguageService), _languageService, true);

            // Remeber the DTE for future use;
            _envDte = GetService(typeof(DTE)) as DTE;

            // Remember the dialog page object
            _languageService.FormattingPage = GetDialogPage(typeof(DaxFormattingPage)) as DaxFormattingPage;

            // Register for idle timer callbacks
            IOleComponentManager mgr = GetService(typeof(SOleComponentManager)) as IOleComponentManager;

            if (_componentID == 0 && mgr != null)
            {
                OLECRINFO[] crinfo = new OLECRINFO[1];
                crinfo[0].cbSize            = (uint)Marshal.SizeOf(typeof(OLECRINFO));
                crinfo[0].grfcrf            = (uint)(_OLECRF.olecrfNeedIdleTime | _OLECRF.olecrfNeedPeriodicIdleTime);
                crinfo[0].grfcadvf          = (uint)(_OLECADVF.olecadvfModal | _OLECADVF.olecadvfRedrawOff | _OLECADVF.olecadvfWarningsOff);
                crinfo[0].uIdleTimeInterval = 1000;
                mgr.FRegisterComponent(this, crinfo, out _componentID);
            }

            AddMenuButtons();

#if DEBUG
            // Redirect console to Debug so log from Parser is visible
            Console.SetError(new ConsoleToDebugRedirector());
#endif
            SyncSnippets();

            Instance = this;
            //commandBars.Add("My Command Bar", new Point(400,400), new CommandBarPopup(),)
        }