public LanguageSettingsPersister( [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider, IGlobalOptionService optionService) : base(assertIsForeground: true) { _textManager = (IVsTextManager4)serviceProvider.GetService(typeof(SVsTextManager)); _optionService = optionService; // TODO: make this configurable _languageMap = BidirectionalMap <string, Tuple <Guid> > .Empty.Add(LanguageNames.CSharp, Tuple.Create(Guids.CSharpLanguageServiceId)) .Add(LanguageNames.VisualBasic, Tuple.Create(Guids.VisualBasicLanguageServiceId)) .Add("TypeScript", Tuple.Create(new Guid("4a0dddb5-7a95-4fbf-97cc-616d07737a77"))) .Add("F#", Tuple.Create(new Guid("BC6DD5A5-D4D6-4dab-A00D-A51242DBAF1B"))) .Add("Xaml", Tuple.Create(new Guid("CD53C9A1-6BC2-412B-BE36-CC715ED8DD41"))); foreach (var languageGuid in _languageMap.Values) { var languagePreferences = new LANGPREFERENCES3[1]; languagePreferences[0].guidLang = languageGuid.Item1; // The function can potentially fail if that language service isn't installed if (ErrorHandler.Succeeded(_textManager.GetUserPreferences4(pViewPrefs: null, pLangPrefs: languagePreferences, pColorPrefs: null))) { RefreshLanguageSettings(languagePreferences); } } _textManagerEvents2Sink = ComEventSink.Advise <IVsTextManagerEvents4>(_textManager, this); }
public LanguageSettingsPersister( [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider, IGlobalOptionService optionService) : base(assertIsForeground: true) { _textManager = (IVsTextManager4)serviceProvider.GetService(typeof(SVsTextManager)); _optionService = optionService; // TODO: make this configurable _languageMap = BidirectionalMap<string, Tuple<Guid>>.Empty.Add(LanguageNames.CSharp, Tuple.Create(Guids.CSharpLanguageServiceId)) .Add(LanguageNames.VisualBasic, Tuple.Create(Guids.VisualBasicLanguageServiceId)) .Add("TypeScript", Tuple.Create(new Guid("4a0dddb5-7a95-4fbf-97cc-616d07737a77"))) .Add("F#", Tuple.Create(new Guid("BC6DD5A5-D4D6-4dab-A00D-A51242DBAF1B"))) .Add("Xaml", Tuple.Create(new Guid("CD53C9A1-6BC2-412B-BE36-CC715ED8DD41"))); foreach (var languageGuid in _languageMap.Values) { var languagePreferences = new LANGPREFERENCES3[1]; languagePreferences[0].guidLang = languageGuid.Item1; // The function can potentially fail if that language service isn't installed if (ErrorHandler.Succeeded(_textManager.GetUserPreferences4(pViewPrefs: null, pLangPrefs: languagePreferences, pColorPrefs: null))) { RefreshLanguageSettings(languagePreferences); } } _textManagerEvents2Sink = ComEventSink.Advise<IVsTextManagerEvents4>(_textManager, this); }
public LanguageSettingsPersister( [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider, IGlobalOptionService optionService) : base(assertIsForeground: true) { _textManager = (IVsTextManager4)serviceProvider.GetService(typeof(SVsTextManager)); _optionService = optionService; // TODO: make this configurable _languageMap = BidirectionalMap <string, Tuple <Guid> > .Empty.Add(LanguageNames.Hlsl, Tuple.Create(Guids.HlslLanguageServiceId)) .Add(LanguageNames.ShaderLab, Tuple.Create(Guids.ShaderLabLanguageServiceId)); foreach (var languageGuid in _languageMap.Values) { var languagePreferences = new LANGPREFERENCES3[1]; languagePreferences[0].guidLang = languageGuid.Item1; // The function can potentially fail if that language service isn't installed if (ErrorHandler.Succeeded(_textManager.GetUserPreferences4(pViewPrefs: null, pLangPrefs: languagePreferences, pColorPrefs: null))) { RefreshLanguageSettings(languagePreferences); } } _textManagerEvents2Sink = ComEventSink.Advise <IVsTextManagerEvents4>(_textManager, this); }
public LanguageSettingsStorage(IVsPackage package, IServiceContainer services, Guid languageServiceId, IEnumerable <string> automationObjectNames) { _package = package; _services = services; _languageServiceId = languageServiceId; _automationObjectNames = automationObjectNames; _textManager = _services.GetService <IVsTextManager4>(typeof(SVsTextManager)); _textManagerEventsCookie = new ConnectionPointCookie(_textManager, this, typeof(IVsTextManagerEvents4)); }
public static LANGPREFERENCES3[] GetNodejsLanguagePreferencesFromTypeScript(IVsTextManager4 textMgr) { var langPrefs = new LANGPREFERENCES3[1]; langPrefs[0].guidLang = Guids.TypeScriptLanguageInfo; ErrorHandler.ThrowOnFailure(textMgr.GetUserPreferences4(null, langPrefs, null)); langPrefs[0].guidLang = typeof(NodejsLanguageInfo).GUID; textMgr.SetUserPreferences4(null, langPrefs, null); return(langPrefs); }
public LanguageSettingsStorage(ICoreShell coreShell, Guid languageServiceId, Guid packageId, IEnumerable <string> automationObjectNames) { _shell = coreShell; _languageServiceId = languageServiceId; _packageGuid = packageId; _automationObjectNames = automationObjectNames; _textManager = _shell.GetService <IVsTextManager4>(typeof(SVsTextManager)); _textManagerEventsCookie = new ConnectionPointCookie(_textManager, this, typeof(IVsTextManagerEvents4)); }
private void HookTextManagerEvents() { IVsTextManager4 textManager = VsAppShell.Current.GlobalServices.GetService <IVsTextManager4>(typeof(SVsTextManager)); Debug.Assert(textManager != null); if (textManager != null) { // Hook into the "preferences changed" event so that I can update _langPrefs as needed _textManagerEventsCookie = new ConnectionPointCookie(textManager, this, typeof(IVsTextManagerEvents4)); } }
private void SetLangPrefs(LANGPREFERENCES3 newPreferences) { IVsTextManager4 textManager = VsAppShell.Current.GlobalServices.GetService <IVsTextManager4>(typeof(SVsTextManager)); Debug.Assert(textManager != null); if (textManager != null) { // Set the language preferences, like "is intellisense turned on?" LANGPREFERENCES3[] langPrefs = { newPreferences }; textManager.SetUserPreferences4(null, langPrefs, null); } }
// We make sure this code is from the UI by asking for the optionservice in the initialize() in AbstractPackage`2 public AbstractLanguageSettingsSerializer(Guid languageServiceguid, string languageName, IServiceProvider serviceProvider) : base(assertIsForeground: true) { _serviceProvider = serviceProvider; _languageName = languageName; _textManager = (IVsTextManager4)serviceProvider.GetService(typeof(SVsTextManager)); var langPrefs = new LANGPREFERENCES3[1]; langPrefs[0].guidLang = languageServiceguid; Marshal.ThrowExceptionForHR(_textManager.GetUserPreferences4(pViewPrefs: null, pLangPrefs: langPrefs, pColorPrefs: null)); _languageSetting = langPrefs[0]; _textManagerEvents2Sink = ComEventSink.Advise <IVsTextManagerEvents4>(_textManager, this); }
public XSharpSmartIndent(ITextView view, IBufferTagAggregatorFactoryService aggregator) { _textView = view; _aggregator = aggregator; _lastIndentValue = 0; _options = _textView.Options; // this does not fire when Smartindent option is changed _options.OptionChanged += Options_OptionChanged; _options.GlobalOptions.OptionChanged += Options_OptionChanged; var package = XSharp.Project.XSharpProjectPackage.Instance; _textManager = package.GetTextManager(); _optionsPage = package.GetIntellisenseOptionsPage(); getOptions(); getKeywords(); }
public static LANGPREFERENCES3[] GetNodejsLanguagePreferencesFromTypeScript(IVsTextManager4 textMgr) { var langPrefs = new LANGPREFERENCES3[1]; langPrefs[0].guidLang = Guids.TypeScriptLanguageInfo; int hr = textMgr.GetUserPreferences4(null, langPrefs, null); if (ErrorHandler.Failed(hr)) { MessageBox.Show(Project.SR.GetString(Project.SR.CouldNotGetTypeScriptLanguagePreferences), Project.SR.ProductName); ErrorHandler.ThrowOnFailure(hr); } langPrefs[0].guidLang = typeof(NodejsLanguageInfo).GUID; textMgr.SetUserPreferences4(null, langPrefs, null); return(langPrefs); }
public int OnUserPreferencesChanged4(VIEWPREFERENCES3[] pViewPrefs, LANGPREFERENCES3[] pLangPrefs, FONTCOLORPREFERENCES2[] pColorPrefs) { IVsTextManager4 textMgr = (IVsTextManager4)NodejsPackage.Instance.GetService(typeof(SVsTextManager)); if (pLangPrefs != null && pLangPrefs.Length > 0 && pLangPrefs[0].guidLang == _preferences.guidLang) { _preferences.IndentStyle = pLangPrefs[0].IndentStyle; _preferences.fAutoListMembers = pLangPrefs[0].fAutoListMembers; _preferences.fAutoListParams = pLangPrefs[0].fAutoListParams; _preferences.fHideAdvancedAutoListMembers = pLangPrefs[0].fHideAdvancedAutoListMembers; // Synchronize settings back to TS language service pLangPrefs[0].guidLang = Guids.TypeScriptLanguageInfo; textMgr.SetUserPreferences4(null, pLangPrefs, null); } return(VSConstants.S_OK); }
public LanguageSettingsPersister( IThreadingContext threadingContext, IVsTextManager4 textManager, IGlobalOptionService globalOptions) : base(threadingContext, assertIsForeground: true) { _textManager = textManager; _globalOptions = globalOptions; var languageMap = BidirectionalMap <string, Tuple <Guid> > .Empty; InitializeSettingsForLanguage(LanguageNames.CSharp, Guids.CSharpLanguageServiceId); InitializeSettingsForLanguage(LanguageNames.VisualBasic, Guids.VisualBasicLanguageServiceId); InitializeSettingsForLanguage(InternalLanguageNames.TypeScript, new Guid("4a0dddb5-7a95-4fbf-97cc-616d07737a77")); InitializeSettingsForLanguage("F#", new Guid("BC6DD5A5-D4D6-4dab-A00D-A51242DBAF1B")); InitializeSettingsForLanguage("Xaml", new Guid("CD53C9A1-6BC2-412B-BE36-CC715ED8DD41")); void InitializeSettingsForLanguage(string languageName, Guid languageGuid) { var languagePreferences = new LANGPREFERENCES3[1]; languagePreferences[0].guidLang = languageGuid; // The function can potentially fail if that language service isn't installed if (ErrorHandler.Succeeded(_textManager.GetUserPreferences4(pViewPrefs: null, pLangPrefs: languagePreferences, pColorPrefs: null))) { RefreshLanguageSettings(languagePreferences, languageName); languageMap = languageMap.Add(languageName, Tuple.Create(languageGuid)); } else { FatalError.ReportWithDumpAndCatch(new InvalidOperationException("GetUserPreferences4 failed"), ErrorSeverity.Diagnostic); } } _languageMap = languageMap; _textManagerEvents2Sink = ComEventSink.Advise <IVsTextManagerEvents4>(_textManager, this); }
public LanguageSettingsPersister( [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider, IGlobalOptionService optionService) : base(assertIsForeground: true) { _textManager = (IVsTextManager4)serviceProvider.GetService(typeof(SVsTextManager)); _optionService = optionService; // TODO: make this configurable _languageMap = BidirectionalMap<string, Guid>.Empty.Add(LanguageNames.CSharp, Guids.CSharpLanguageServiceId) .Add(LanguageNames.VisualBasic, Guids.VisualBasicLanguageServiceId) .Add("TypeScript", new Guid("4a0dddb5-7a95-4fbf-97cc-616d07737a77")); foreach (var languageGuid in _languageMap.Values) { var languagePreferences = new LANGPREFERENCES3[1]; languagePreferences[0].guidLang = languageGuid; Marshal.ThrowExceptionForHR(_textManager.GetUserPreferences4(pViewPrefs: null, pLangPrefs: languagePreferences, pColorPrefs: null)); RefreshLanguageSettings(languagePreferences); } _textManagerEvents2Sink = ComEventSink.Advise<IVsTextManagerEvents4>(_textManager, this); }
///////////////////////////////////////////////////////////////////////////// // Overridden 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 initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); SubscribeToVsCommandEvents( (int)VSConstants.VSStd97CmdID.AddNewProject, delegate { NewProjectFromExistingWizard.IsAddNewProjectCmd = true; }, delegate { NewProjectFromExistingWizard.IsAddNewProjectCmd = false; } ); var langService = new NodejsLanguageInfo(this); ((IServiceContainer)this).AddService(langService.GetType(), langService, true); ((IServiceContainer)this).AddService(typeof(ClipboardServiceBase), new ClipboardService(), true); RegisterProjectFactory(new NodejsProjectFactory(this)); RegisterEditorFactory(new NodejsEditorFactory(this)); RegisterEditorFactory(new NodejsEditorFactoryPromptForEncoding(this)); RegisterEditorFactory(new JadeEditorFactory(this)); // Add our command handlers for menu (commands must exist in the .vsct file) var commands = new List <Command> { new OpenReplWindowCommand(), new OpenRemoteDebugProxyFolderCommand(), new OpenRemoteDebugDocumentationCommand(), new SurveyNewsCommand(), new ImportWizardCommand(), new DiagnosticsCommand(this) }; try { commands.Add(new AzureExplorerAttachDebuggerCommand()); } catch (NotSupportedException) { } RegisterCommands(commands, Guids.NodejsCmdSet); IVsTextManager4 textMgr = (IVsTextManager4)Instance.GetService(typeof(SVsTextManager)); LANGPREFERENCES3[] langPrefs = GetNodejsLanguagePreferencesFromTypeScript(textMgr); _langPrefs = new LanguagePreferences(langPrefs[0]); var textManagerEvents2Guid = typeof(IVsTextManagerEvents4).GUID; IConnectionPoint textManagerEvents2ConnectionPoint; ((IConnectionPointContainer)textMgr).FindConnectionPoint(ref textManagerEvents2Guid, out textManagerEvents2ConnectionPoint); uint cookie; textManagerEvents2ConnectionPoint.Advise(_langPrefs, out cookie); var textManagerEventsGuid = typeof(IVsTextManagerEvents).GUID; IConnectionPoint textManagerEventsConnectionPoint; ((IConnectionPointContainer)textMgr).FindConnectionPoint(ref textManagerEventsGuid, out textManagerEventsConnectionPoint); textManagerEventsConnectionPoint.Advise(new DataTipTextManagerEvents(this), out cookie); MakeDebuggerContextAvailable(); IntellisenseOptionsPage.AnalysisLogMaximumChanged += IntellisenseOptionsPage_AnalysisLogMaximumChanged; IntellisenseOptionsPage.AnalysisLevelChanged += IntellisenseOptionsPageAnalysisLevelChanged; IntellisenseOptionsPage.SaveToDiskChanged += IntellisenseOptionsPageSaveToDiskChanged; InitializeLogging(); InitializeTelemetry(); // The variable is inherited by child processes backing Test Explorer, and is used in // the NTVS test discoverer and test executor to connect back to VS. Environment.SetEnvironmentVariable(NodejsConstants.NodeToolsProcessIdEnvironmentVariable, Process.GetCurrentProcess().Id.ToString()); }
///////////////////////////////////////////////////////////////////////////// // Overridden 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 initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); if (!_hasRequiredTypescriptVersion.Value) { MessageBox.Show( Project.SR.GetString(Project.SR.TypeScriptMinVersionNotInstalled, _minRequiredTypescriptVersion.ToString()), Project.SR.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } SubscribeToVsCommandEvents( (int)VSConstants.VSStd97CmdID.AddNewProject, delegate { NewProjectFromExistingWizard.IsAddNewProjectCmd = true; }, delegate { NewProjectFromExistingWizard.IsAddNewProjectCmd = false; } ); var langService = new NodejsLanguageInfo(this); ((IServiceContainer)this).AddService(langService.GetType(), langService, true); ((IServiceContainer)this).AddService(typeof(ClipboardServiceBase), new ClipboardService(), true); RegisterProjectFactory(new NodejsProjectFactory(this)); RegisterEditorFactory(new JadeEditorFactory(this)); // Add our command handlers for menu (commands must exist in the .vsct file) var commands = new List <Command> { new OpenReplWindowCommand(), new OpenRemoteDebugProxyFolderCommand(), new OpenRemoteDebugDocumentationCommand(), new SurveyNewsCommand(), new ImportWizardCommand(), new DiagnosticsCommand(this), new SendFeedbackCommand(), new ShowDocumentationCommand() }; try { commands.Add(new AzureExplorerAttachDebuggerCommand()); } catch (NotSupportedException) { } RegisterCommands(commands, Guids.NodejsCmdSet); IVsTextManager4 textMgr = (IVsTextManager4)Instance.GetService(typeof(SVsTextManager)); LANGPREFERENCES3[] langPrefs = GetNodejsLanguagePreferencesFromTypeScript(textMgr); _langPrefs = new LanguagePreferences(langPrefs[0]); var textManagerEvents2Guid = typeof(IVsTextManagerEvents4).GUID; IConnectionPoint textManagerEvents2ConnectionPoint; ((IConnectionPointContainer)textMgr).FindConnectionPoint(ref textManagerEvents2Guid, out textManagerEvents2ConnectionPoint); uint cookie; textManagerEvents2ConnectionPoint.Advise(_langPrefs, out cookie); var textManagerEventsGuid = typeof(IVsTextManagerEvents).GUID; IConnectionPoint textManagerEventsConnectionPoint; ((IConnectionPointContainer)textMgr).FindConnectionPoint(ref textManagerEventsGuid, out textManagerEventsConnectionPoint); textManagerEventsConnectionPoint.Advise(new DataTipTextManagerEvents(this), out cookie); MakeDebuggerContextAvailable(); InitializeLogging(); InitializeTelemetry(); // The variable is inherited by child processes backing Test Explorer, and is used in // the NTVS test discoverer and test executor to connect back to VS. Environment.SetEnvironmentVariable(NodejsConstants.NodeToolsProcessIdEnvironmentVariable, Process.GetCurrentProcess().Id.ToString()); #if DEV15 var root = Environment.GetEnvironmentVariable("VsInstallRoot"); if (!string.IsNullOrEmpty(root)) { Environment.SetEnvironmentVariable(NodejsConstants.NodeToolsVsInstallRootEnvironmentVariable, root); } #endif }
// XSharpLanguageService _langService = null; #region Overridden Implementation /// <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 async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { // Suspend walking until Solution is opened. base.SolutionListeners.Add(new ModelScannerEvents(this)); await base.InitializeAsync(cancellationToken, progress); await JoinableTaskFactory.SwitchToMainThreadAsync(); _uiThread = new UIThread(); XSharpProjectPackage.instance = this; XSharpModel.XSolution.OutputWindow = this; this.RegisterProjectFactory(new XSharpProjectFactory(this)); this.settings = new XPackageSettings(this); validateVulcanEditors(); this.RegisterDebuggerEvents(); // Indicate how to open the different source files : SourceCode or Designer ?? this.RegisterEditorFactory(new XSharpEditorFactory(this)); this.RegisterProjectFactory(new XSharpWPFProjectFactory(this)); // editors for the binaries base.RegisterEditorFactory(new VOFormEditorFactory(this)); base.RegisterEditorFactory(new VOMenuEditorFactory(this)); base.RegisterEditorFactory(new VODBServerEditorFactory(this)); base.RegisterEditorFactory(new VOFieldSpecEditorFactory(this)); XSharp.Project.XSharpMenuItems.Initialize(this); // Register a timer to call our language service during // idle periods. IOleComponentManager mgr = await GetServiceAsync(typeof(SOleComponentManager)) as IOleComponentManager; if (m_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 m_componentID); } // Initialize Custom Menu Items // register property changed event handler var shell = await this.GetServiceAsync(typeof(SVsShell)) as IVsShell; Assumes.Present(shell); shell.AdviseShellPropertyChanges(this, out shellCookie); // // ObjectBrowser : Add the LibraryManager service as a Service provided by that container IServiceContainer container = this as IServiceContainer; ServiceCreatorCallback callback = new ServiceCreatorCallback(CreateLibraryService); // container.AddService(typeof(IXSharpLibraryManager), callback, true); this._documentWatcher = new XSharpDocumentWatcher(this); _txtManager = await GetServiceAsync(typeof(SVsTextManager)) as IVsTextManager4; // determine version of VS object vers; shell.GetProperty((int)__VSSPROPID5.VSSPROPID_ReleaseVersion, out vers); VsVersion = vers.ToString(); _errorList = await GetServiceAsync(typeof(SVsErrorList)) as IErrorList; _taskList = await GetServiceAsync(typeof(SVsTaskList)) as ITaskList; }
public static LANGPREFERENCES3[] GetNodejsLanguagePreferencesFromTypeScript(IVsTextManager4 textMgr) { var langPrefs = new LANGPREFERENCES3[1]; langPrefs[0].guidLang = Guids.TypeScriptLanguageInfo; ErrorHandler.ThrowOnFailure(textMgr.GetUserPreferences4(null, langPrefs, null)); langPrefs[0].guidLang = typeof(NodejsLanguageInfo).GUID; textMgr.SetUserPreferences4(null, langPrefs, null); return langPrefs; }
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 static LANGPREFERENCES3[] GetNodejsLanguagePreferencesFromTypeScript(IVsTextManager4 textMgr) { var langPrefs = new LANGPREFERENCES3[1]; langPrefs[0].guidLang = Guids.TypeScriptLanguageInfo; int hr = textMgr.GetUserPreferences4(null, langPrefs, null); if (ErrorHandler.Failed(hr)) { MessageBox.Show(Project.SR.GetString(Project.SR.CouldNotGetTypeScriptLanguagePreferences), Project.SR.ProductName); ErrorHandler.ThrowOnFailure(hr); } langPrefs[0].guidLang = typeof(NodejsLanguageInfo).GUID; textMgr.SetUserPreferences4(null, langPrefs, null); return langPrefs; }