private ReplWindowInfo CreateReplWindowInternal(IReplEvaluator evaluator, IContentType contentType, string[] roles, int id, string title, Guid languageServiceGuid, string replId)
        {
            var service = (IVsUIShell)ServiceProvider.GlobalProvider.GetService(typeof(SVsUIShell));
            var model   = (IComponentModel)ServiceProvider.GlobalProvider.GetService(typeof(SComponentModel));

            SaveReplInfo(id, evaluator, contentType, roles, title, languageServiceGuid, replId);

            // we don't pass __VSCREATETOOLWIN.CTW_fMultiInstance because multi instance panes are
            // destroyed when closed.  We are really multi instance but we don't want to be closed.  This
            // seems to work fine.
            __VSCREATETOOLWIN creationFlags = 0;

            if (!roles.Contains("DontPersist"))
            {
                creationFlags |= __VSCREATETOOLWIN.CTW_fForceCreate;
            }

            var replWindow = _windowFactory.Create(GuidList.guidPythonInteractiveWindowGuid, id, title, evaluator, creationFlags);

            replWindow.SetLanguage(GuidList.guidPythonLanguageServiceGuid, contentType);
            replWindow.InteractiveWindow.InitializeAsync();
            return(_windows[id] = new ReplWindowInfo(replWindow, replId));
        }
示例#2
0
        internal static IInteractiveWindowCommands GetInteractiveCommands(IServiceProvider serviceProvider, IInteractiveWindow window, IReplEvaluator eval) {
            var cmdFactory = serviceProvider.GetComponentModel().GetService<IInteractiveWindowCommandsFactory>();
            var cmds = serviceProvider.GetComponentModel().GetExtensions<IInteractiveWindowCommand>();
            string[] roles = eval.GetType().GetCustomAttributes(typeof(InteractiveWindowRoleAttribute), true).Select(r => ((InteractiveWindowRoleAttribute)r).Name).ToArray();

            return cmdFactory.CreateInteractiveCommands(window, "$", cmds.Where(x => IsCommandApplicable(x, roles)));
        }
        private ReplWindowInfo CreateReplWindowInternal(IReplEvaluator evaluator, IContentType contentType, string[] roles, int id, string title, Guid languageServiceGuid, string replId) {
            var service = (IVsUIShell)ServiceProvider.GlobalProvider.GetService(typeof(SVsUIShell));
            var model = (IComponentModel)ServiceProvider.GlobalProvider.GetService(typeof(SComponentModel));

            SaveReplInfo(id, evaluator, contentType, roles, title, languageServiceGuid, replId);

            // we don't pass __VSCREATETOOLWIN.CTW_fMultiInstance because multi instance panes are
            // destroyed when closed.  We are really multi instance but we don't want to be closed.  This
            // seems to work fine.
            __VSCREATETOOLWIN creationFlags = 0;
            if (!roles.Contains("DontPersist")) {
                creationFlags |= __VSCREATETOOLWIN.CTW_fForceCreate;
            }

            var replWindow = _windowFactory.Create(GuidList.guidPythonInteractiveWindowGuid, id, title, evaluator, creationFlags);
            replWindow.SetLanguage(GuidList.guidPythonLanguageServiceGuid, contentType);
            replWindow.InteractiveWindow.InitializeAsync();

            return _windows[id] = new ReplWindowInfo(replWindow, replId);
        }
 private ReplWindowInfo CreateReplWindow(IReplEvaluator /*!*/ evaluator, IContentType /*!*/ contentType, string[] roles, int id, string /*!*/ title, Guid languageServiceGuid, string replId)
 {
     return(CreateReplWindowInternal(evaluator, contentType, roles, id, title, languageServiceGuid, replId));
 }
 private ReplWindowInfo CreateReplWindow(IReplEvaluator/*!*/ evaluator, IContentType/*!*/ contentType, string[] roles, int id, string/*!*/ title, Guid languageServiceGuid, string replId) {
     return CreateReplWindowInternal(evaluator, contentType, roles, id, title, languageServiceGuid, replId);
 }