Beispiel #1
0
        /// <summary>
        /// This method formats the given span using the given EditArray.
        /// An empty input span means reformat the entire document.
        /// </summary>
        public override void ReformatSpan(EditArray mgr, TextSpan span)
        {
            Babel.LanguageService langService = this.LanguageService as Babel.LanguageService;
            DaxFormatter          formatter   = new DaxFormatter(this, mgr, span, Environment.NewLine, this.LanguageService.Preferences, langService.FormattingPage.IndentDepthInFunctions, langService.FormattingPage.FormatterType);

            formatter.Format();
        }
Beispiel #2
0
        protected BabelPackage()
        {
            ServiceCreatorCallback callback = new ServiceCreatorCallback(
                delegate(IServiceContainer container, Type serviceType)
            {
                if (typeof(Babel.LanguageService) == serviceType)
                {
                    Babel.LanguageService language = new Babel.LanguageService();
                    language.SetSite(this);

                    // register for idle time 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 |
                                             (uint)_OLECRF.olecrfNeedPeriodicIdleTime;
                        crinfo[0].grfcadvf = (uint)_OLECADVF.olecadvfModal |
                                             (uint)_OLECADVF.olecadvfRedrawOff |
                                             (uint)_OLECADVF.olecadvfWarningsOff;
                        crinfo[0].uIdleTimeInterval = 1000;
                        int hr = mgr.FRegisterComponent(this, crinfo, out componentID);
                    }

                    return(language);
                }
                else
                {
                    return(null);
                }
            });

            // proffer the LanguageService
            (this as IServiceContainer).AddService(typeof(Babel.LanguageService), callback, true);
        }
Beispiel #3
0
        protected BabelPackage()
        {
            ServiceCreatorCallback callback = new ServiceCreatorCallback(
                delegate(IServiceContainer container, Type serviceType)
                {
                    if (typeof(Babel.LanguageService) == serviceType)
                    {
                        Babel.LanguageService language = new Babel.LanguageService();
                        language.SetSite(this);

                        // register for idle time 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 |
                                                          (uint)_OLECRF.olecrfNeedPeriodicIdleTime;
                            crinfo[0].grfcadvf = (uint)_OLECADVF.olecadvfModal |
                                                          (uint)_OLECADVF.olecadvfRedrawOff |
                                                          (uint)_OLECADVF.olecadvfWarningsOff;
                            crinfo[0].uIdleTimeInterval = 1000;
                            int hr = mgr.FRegisterComponent(this, crinfo, out componentID);
                        }

                        return language;
                    }
                    else
                    {
                        return null;
                    }
                });

            // proffer the LanguageService
            (this as IServiceContainer).AddService(typeof(Babel.LanguageService), callback, true);
        }