protected override async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { instance = this; ModelScannerEvents.Start(); await base.InitializeAsync(cancellationToken, progress); _txtManager = await GetServiceAsync(typeof(SVsTextManager)) as IVsTextManager4; Assumes.Present(_txtManager); // register property changed event handler await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); XSharpXMLDocTools.Initialize(); var shell = await this.GetServiceAsync(typeof(SVsShell)) as IVsShell; if (shell != null) { shell.AdviseShellPropertyChanges(this, out shellCookie); } IServiceContainer serviceContainer = this as IServiceContainer; XSharpLegacyLanguageService languageService = new XSharpLegacyLanguageService(serviceContainer); languageService.SetSite(this); serviceContainer.AddService(typeof(XSharpLegacyLanguageService), languageService, true); //if (!XSettings.DisableClassViewObjectView) //{ // ServiceCreatorCallback callback = new ServiceCreatorCallback(CreateLibraryService); // serviceContainer.AddService(typeof(IXSharpLibraryManager), callback, true); //} RegisterDebuggerEvents(); addOurFileExtensionsForDiffAndPeek("Diff\\SupportedContentTypes"); addOurFileExtensionsForDiffAndPeek("Peek\\SupportedContentTypes"); // Register a timer to call several services // idle periods. _oleComponentManager = await GetServiceAsync(typeof(SOleComponentManager)) as IOleComponentManager; if (m_componentID == 0 && _oleComponentManager != 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 = _oleComponentManager.FRegisterComponent(this, crinfo, out m_componentID); } GetIntellisenseSettings(); await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); XSettings.LanguageService = this; }
public XSharpSource(XSharpLegacyLanguageService service, IVsTextLines textLines, Colorizer colorizer) : base(service, textLines, colorizer) { }