private void InitializeInternal() { _intelliSenseServiceContext = new IntelliSenseEventsHandlerProxy(); var diagnosticsPage = (DiagnosticsDialogPage)GetDialogPage(typeof(DiagnosticsDialogPage)); if (diagnosticsPage.EnableDiagnosticLogging) { DiagnosticConfiguration.EnableDiagnostics(); } Log.Info(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this)); var langService = new PowerShellLanguageInfo(this); ((IServiceContainer)this).AddService(langService.GetType(), langService, true); _textBufferFactoryService = ComponentModel.GetService <ITextBufferFactoryService>(); if (_textBufferFactoryService != null) { _textBufferFactoryService.TextBufferCreated += TextBufferFactoryService_TextBufferCreated; } var textManager = (IVsTextManager)GetService(typeof(SVsTextManager)); var adaptersFactory = ComponentModel.GetService <IVsEditorAdaptersFactoryService>(); RefreshCommands(new ExecuteSelectionCommand(this.DependencyValidator), new ExecuteFromEditorContextMenuCommand(this.DependencyValidator), new ExecuteWithParametersAsScriptCommand(adaptersFactory, textManager, this.DependencyValidator), new ExecuteFromSolutionExplorerContextMenuCommand(this.DependencyValidator), new ExecuteWithParametersAsScriptFromSolutionExplorerCommand(adaptersFactory, textManager, this.DependencyValidator), new PrettyPrintCommand(), new OpenDebugReplCommand(), new OpenExplorerCommand()); try { Threading.Task.Run( () => { InitializePowerShellHost(); } ); } catch (AggregateException ae) { Log.Error("Failed to initalize PowerShell host.", ae.Flatten()); MessageBox.Show( Resources.PowerShellHostInitializeFailed, Resources.MessageBoxErrorTitle, MessageBoxButton.OK, MessageBoxImage.Error); throw ae.Flatten(); } }
private void InitializeInternal() { var page = (DiagnosticsDialogPage)GetDialogPage(typeof(DiagnosticsDialogPage)); if (page.EnableDiagnosticLogging) { DiagnosticConfiguration.EnableDiagnostics(); } Log.Info(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this)); base.Initialize(); var langService = new PowerShellLanguageInfo(this); ((IServiceContainer)this).AddService(langService.GetType(), langService, true); var componentModel = (IComponentModel)GetGlobalService(typeof(SComponentModel)); _textBufferFactoryService = componentModel.GetService <ITextBufferFactoryService>(); EditorImports.ClassificationTypeRegistryService = componentModel.GetService <IClassificationTypeRegistryService>(); EditorImports.ClassificationFormatMap = componentModel.GetService <IClassificationFormatMapService>(); _visualStudioEvents = componentModel.GetService <VisualStudioEvents>(); _visualStudioEvents.SettingsChanged += _visualStudioEvents_SettingsChanged; if (_textBufferFactoryService != null) { _textBufferFactoryService.TextBufferCreated += TextBufferFactoryService_TextBufferCreated; } InitializePowerShellHost(); _gotoDefinitionCommand = new GotoDefinitionCommand(); RefreshCommands(new ExecuteSelectionCommand(), new ExecuteAsScriptCommand(), _gotoDefinitionCommand, new PrettyPrintCommand(Debugger.Runspace), new OpenDebugReplCommand()); }