private IVsInteractiveWindow CreateInteractiveWindowInternal( IInteractiveEvaluator evaluator, IContentType contentType, bool alwaysCreate, int id, string title, Guid languageServiceGuid, string replId ) { var creationFlags = __VSCREATETOOLWIN.CTW_fMultiInstance | __VSCREATETOOLWIN.CTW_fActivateWithProject; if (alwaysCreate) { creationFlags |= __VSCREATETOOLWIN.CTW_fForceCreate; } #if DEV15_OR_LATER var windowFactory2 = _windowFactory as IVsInteractiveWindowFactory2; var replWindow = windowFactory2.Create( GuidList.guidPythonInteractiveWindowGuid, id, title, evaluator, creationFlags, GuidList.guidPythonToolsCmdSet, PythonConstants.ReplWindowToolbar, null ); #else var replWindow = _windowFactory.Create( GuidList.guidPythonInteractiveWindowGuid, id, title, evaluator, creationFlags ); #endif replWindow.InteractiveWindow.Properties[VsInteractiveWindowKey] = replWindow; var toolWindow = replWindow as ToolWindowPane; if (toolWindow != null) { toolWindow.BitmapImageMoniker = KnownMonikers.PYInteractiveWindow; } replWindow.SetLanguage(GuidList.guidPythonLanguageServiceGuid, contentType); var selectEval = evaluator as SelectableReplEvaluator; if (selectEval != null) { selectEval.ProvideInteractiveWindowEvents(InteractiveWindowEvents.GetOrCreate(replWindow)); } _serviceProvider.GetUIThread().InvokeTaskSync(() => replWindow.InteractiveWindow.InitializeAsync(), CancellationToken.None); return(replWindow); }
private IVsInteractiveWindow CreateInteractiveWindowInternal( IInteractiveEvaluator evaluator, IContentType contentType, bool alwaysCreate, int id, string title, Guid languageServiceGuid, string replId ) { var creationFlags = __VSCREATETOOLWIN.CTW_fMultiInstance | __VSCREATETOOLWIN.CTW_fActivateWithProject; if (alwaysCreate) { creationFlags |= __VSCREATETOOLWIN.CTW_fForceCreate; } var replWindow = _windowFactory.Create(GuidList.guidPythonInteractiveWindowGuid, id, title, evaluator, creationFlags); replWindow.InteractiveWindow.Properties[VsInteractiveWindowKey] = replWindow; var toolWindow = replWindow as ToolWindowPane; if (toolWindow != null) { toolWindow.BitmapImageMoniker = KnownMonikers.PYInteractiveWindow; } replWindow.SetLanguage(GuidList.guidPythonLanguageServiceGuid, contentType); replWindow.InteractiveWindow.InitializeAsync(); var selectEval = evaluator as SelectableReplEvaluator; if (selectEval != null) { selectEval.ProvideInteractiveWindowEvents(InteractiveWindowEvents.GetOrCreate(replWindow)); } return(replWindow); }
internal void ProvideInteractiveWindowEvents(InteractiveWindowEvents events) { events.Closed += InteractiveWindow_Closed; }
private IVsInteractiveWindow CreateInteractiveWindowInternal( IInteractiveEvaluator evaluator, IContentType contentType, bool alwaysCreate, int id, string title, Guid languageServiceGuid, string replId ) { var creationFlags = __VSCREATETOOLWIN.CTW_fMultiInstance | __VSCREATETOOLWIN.CTW_fActivateWithProject; if (alwaysCreate) { creationFlags |= __VSCREATETOOLWIN.CTW_fForceCreate; } #if DEV15_OR_LATER var windowFactory2 = _windowFactory as IVsInteractiveWindowFactory2; var replWindow = windowFactory2.Create( CommonGuidList.guidPythonInteractiveWindowGuid, id, title, evaluator, creationFlags, CommonGuidList.guidPythonToolsCmdSet, PythonConstants.ReplWindowToolbar, null ); #else var replWindow = _windowFactory.Create( CommonGuidList.guidPythonInteractiveWindowGuid, id, title, evaluator, creationFlags ); #endif replWindow.InteractiveWindow.Properties[VsInteractiveWindowId] = id; replWindow.InteractiveWindow.Properties[VsInteractiveWindowKey] = replWindow; var toolWindow = replWindow as ToolWindowPane; if (toolWindow != null) { toolWindow.BitmapImageMoniker = KnownMonikers.PYInteractiveWindow; } // Initializes the command filters with the base Python content type // so that our MEF exports, such as ReplWindowCreationListener, are activated. var pythonContentType = _contentTypeService.GetContentType(PythonCoreConstants.ContentType); replWindow.SetLanguage(CommonGuidList.guidPythonLanguageServiceGuid, pythonContentType); var selectEval = evaluator as SelectableReplEvaluator; if (selectEval != null) { selectEval.ProvideInteractiveWindowEvents(InteractiveWindowEvents.GetOrCreate(replWindow)); } // Start repl but don't wait. It will block on the main thread replWindow.InteractiveWindow.InitializeAsync().DoNotWait(); return(replWindow); }
internal void ProvideInteractiveWindowEvents(InteractiveWindowEvents events) { events.Closed += InteractiveWindow_Closed; }