private EditorSession CreateDebugSession( HostDetails hostDetails, ProfilePaths profilePaths, IMessageSender messageSender, IMessageHandlers messageHandlers, IEditorOperations editorOperations, 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.StartDebugSession( powerShellContext, hostUserInterface, editorOperations); return(editorSession); }
public static PowerShellContext Create(ILogger logger) { PowerShellContext powerShellContext = new PowerShellContext(logger); powerShellContext.Initialize( PowerShellContextTests.TestProfilePaths, PowerShellContext.CreateRunspace( PowerShellContextTests.TestHostDetails, powerShellContext, new TestPSHostUserInterface(powerShellContext, logger), logger), true); return(powerShellContext); }
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); }