public ScriptDebugger(bool overrideExecutionPolicy, DTE2 dte2) { HostUi = new HostUi(this); InitialSessionState iss = InitialSessionState.CreateDefault(); iss.ApartmentState = ApartmentState.STA; iss.ThreadOptions = PSThreadOptions.ReuseThread; _runspace = RunspaceFactory.CreateRunspace(this, iss); _runspace.Open(); _runspaceRef = new RunspaceRef(_runspace); //TODO: I think this is a v4 thing. Probably need to look into it. //_runspaceRef.Runspace.Debugger.SetDebugMode(DebugModes.LocalScript | DebugModes.RemoteScript); //Provide access to the DTE via PowerShell. //This also allows PoshTools to support StudioShell. _runspace.SessionStateProxy.PSVariable.Set("dte", dte2); ImportPoshToolsModule(); LoadProfile(); if (overrideExecutionPolicy) { SetupExecutionPolicy(); } SetRunspace(Runspace); }
public void SetRunspace(Runspace runspace) { _runspace = runspace; RunspaceRef = new System.Management.Automation.Remoting.RunspaceRef(_runspace); }
internal CommandCompletion(RunspaceRef runspaceRef) : base((CommandCompletionBase.CompletionExecutionHelperBase) new CommandCompletionBase.CompletionExecutionHelper(runspaceRef)) { }