Exemple #1
0
        private EditorSession CreateSession(
            HostDetails hostDetails,
            ProfilePaths profilePaths,
            IMessageSender messageSender,
            IMessageHandlers messageHandlers,
            bool enableConsoleRepl)
        {
            EditorSession     editorSession     = new EditorSession(this.logger);
            PowerShellContext powerShellContext = new PowerShellContext(this.logger);

            EditorServicesPSHostUserInterface hostUserInterface =
                enableConsoleRepl
                    ? (EditorServicesPSHostUserInterface) new TerminalPSHostUserInterface(powerShellContext, this.logger)
                    : new ProtocolPSHostUserInterface(powerShellContext, messageSender, messageHandlers, this.logger);

            EditorServicesPSHost psHost =
                new EditorServicesPSHost(
                    powerShellContext,
                    hostDetails,
                    hostUserInterface,
                    this.logger);

            Runspace initialRunspace = PowerShellContext.CreateRunspace(psHost);

            powerShellContext.Initialize(profilePaths, initialRunspace, true, hostUserInterface);

            editorSession.StartSession(powerShellContext, hostUserInterface);

            return(editorSession);
        }
Exemple #2
0
        public DebuggerService2(RunbookViewModel runbookViewModel)
        {
            Logger.Initialize(Path.Combine(AppHelper.CachePath, "PowerShellEditorServices.log"), LogLevel.Verbose);

            /*_powerShell = new PowerShellContext();
             * _workspace = new Workspace(_powerShell.PowerShellVersion);
             *
             * _debugService = new DebugService(_powerShell);
             * _debugService.DebuggerStopped += OnDebugStopped;*/
            _editorSession = new EditorSession();
            _editorSession.StartSession();
            _editorSession.DebugService.DebuggerStopped += OnDebugStopped;
            _editorSession.ConsoleService.OutputWritten += OnConsoleOutputWritten;

            _runbookViewModel = runbookViewModel;

            _breakpoints = new List <LineBreakpoint>();
        }
Exemple #3
0
        private EditorSession CreateSession(
            HostDetails hostDetails,
            ProfilePaths profilePaths,
            IMessageSender messageSender,
            IMessageHandlers messageHandlers,
            bool enableConsoleRepl)
        {
            EditorSession     editorSession     = new EditorSession(this.logger);
            PowerShellContext powerShellContext = new PowerShellContext(this.logger);

            EditorServicesPSHostUserInterface hostUserInterface =
                enableConsoleRepl
                    ? (EditorServicesPSHostUserInterface) new TerminalPSHostUserInterface(powerShellContext, this.logger)
                    : new ProtocolPSHostUserInterface(powerShellContext, messageSender, this.logger);

            EditorServicesPSHost psHost =
                new EditorServicesPSHost(
                    powerShellContext,
                    hostDetails,
                    hostUserInterface,
                    this.logger);

            Runspace initialRunspace = PowerShellContext.CreateRunspace(psHost);

            powerShellContext.Initialize(profilePaths, initialRunspace, true, hostUserInterface);

            editorSession.StartSession(powerShellContext, hostUserInterface);

            // TODO: Move component registrations elsewhere!
            editorSession.Components.Register(this.logger);
            editorSession.Components.Register(messageHandlers);
            editorSession.Components.Register(messageSender);
            editorSession.Components.Register(powerShellContext);

            CodeLensFeature.Create(editorSession.Components, editorSession);
            DocumentSymbolFeature.Create(editorSession.Components, editorSession);

            return(editorSession);
        }