11
11
using System . Collections . Generic ;
12
12
using System . Globalization ;
13
13
using System . Management . Automation . Host ;
14
- using SMA = System . Management . Automation ;
14
+ using Microsoft . PowerShell . EditorServices . Services . PowerShell . Debugging ;
15
+ using Microsoft . PowerShell . EditorServices . Services . PowerShell . Execution ;
16
+ using Microsoft . PowerShell . EditorServices . Services . PowerShell . Utility ;
17
+ using Microsoft . PowerShell . EditorServices . Utility ;
18
+ using System . IO ;
19
+ using System . Reflection ;
20
+ using System . Text ;
21
+ using System . Threading ;
22
+ using System . Threading . Tasks ;
15
23
16
24
namespace Microsoft . PowerShell . EditorServices . Services . PowerShell . Host
17
25
{
18
- using Microsoft . PowerShell . EditorServices . Services . PowerShell . Debugging ;
19
- using Microsoft . PowerShell . EditorServices . Services . PowerShell . Execution ;
20
- using Microsoft . PowerShell . EditorServices . Services . PowerShell . Utility ;
21
- using Microsoft . PowerShell . EditorServices . Utility ;
22
- using System . IO ;
23
26
using System . Management . Automation ;
24
27
using System . Management . Automation . Runspaces ;
25
- using System . Reflection ;
26
- using System . Text ;
27
- using System . Threading ;
28
- using System . Threading . Tasks ;
29
28
30
29
internal class PsesInternalHost : PSHost , IHostSupportsInteractiveSession , IRunspaceContext , IInternalPowerShellExecutionService
31
30
{
@@ -117,7 +116,7 @@ public PsesInternalHost(
117
116
118
117
public RunspaceInfo CurrentRunspace => CurrentFrame . RunspaceInfo ;
119
118
120
- public SMA . PowerShell CurrentPowerShell => CurrentFrame . PowerShell ;
119
+ public PowerShell CurrentPowerShell => CurrentFrame . PowerShell ;
121
120
122
121
public EditorServicesConsolePSHost PublicHost { get ; }
123
122
@@ -253,7 +252,7 @@ public void CancelCurrentTask()
253
252
public Task < TResult > ExecuteDelegateAsync < TResult > (
254
253
string representation ,
255
254
ExecutionOptions executionOptions ,
256
- Func < SMA . PowerShell , CancellationToken , TResult > func ,
255
+ Func < PowerShell , CancellationToken , TResult > func ,
257
256
CancellationToken cancellationToken )
258
257
{
259
258
return InvokeTaskOnPipelineThreadAsync ( new SynchronousPSDelegateTask < TResult > ( _logger , this , representation , executionOptions ?? ExecutionOptions . Default , func , cancellationToken ) ) ;
@@ -262,7 +261,7 @@ public Task<TResult> ExecuteDelegateAsync<TResult>(
262
261
public Task ExecuteDelegateAsync (
263
262
string representation ,
264
263
ExecutionOptions executionOptions ,
265
- Action < SMA . PowerShell , CancellationToken > action ,
264
+ Action < PowerShell , CancellationToken > action ,
266
265
CancellationToken cancellationToken )
267
266
{
268
267
return InvokeTaskOnPipelineThreadAsync ( new SynchronousPSDelegateTask ( _logger , this , representation , executionOptions ?? ExecutionOptions . Default , action , cancellationToken ) ) ;
@@ -325,13 +324,13 @@ public IReadOnlyList<TResult> InvokePSCommand<TResult>(PSCommand psCommand, Powe
325
324
public void InvokePSCommand ( PSCommand psCommand , PowerShellExecutionOptions executionOptions , CancellationToken cancellationToken )
326
325
=> InvokePSCommand < PSObject > ( psCommand , executionOptions , cancellationToken ) ;
327
326
328
- public TResult InvokePSDelegate < TResult > ( string representation , ExecutionOptions executionOptions , Func < SMA . PowerShell , CancellationToken , TResult > func , CancellationToken cancellationToken )
327
+ public TResult InvokePSDelegate < TResult > ( string representation , ExecutionOptions executionOptions , Func < PowerShell , CancellationToken , TResult > func , CancellationToken cancellationToken )
329
328
{
330
329
var task = new SynchronousPSDelegateTask < TResult > ( _logger , this , representation , executionOptions , func , cancellationToken ) ;
331
330
return task . ExecuteAndGetResult ( cancellationToken ) ;
332
331
}
333
332
334
- public void InvokePSDelegate ( string representation , ExecutionOptions executionOptions , Action < SMA . PowerShell , CancellationToken > action , CancellationToken cancellationToken )
333
+ public void InvokePSDelegate ( string representation , ExecutionOptions executionOptions , Action < PowerShell , CancellationToken > action , CancellationToken cancellationToken )
335
334
{
336
335
var task = new SynchronousPSDelegateTask ( _logger , this , representation , executionOptions , action , cancellationToken ) ;
337
336
task . ExecuteAndGetResult ( cancellationToken ) ;
@@ -361,7 +360,7 @@ private void Run()
361
360
return ( pwsh , localRunspaceInfo ) ;
362
361
}
363
362
364
- private void PushPowerShellAndRunLoop ( SMA . PowerShell pwsh , PowerShellFrameType frameType , RunspaceInfo newRunspaceInfo = null )
363
+ private void PushPowerShellAndRunLoop ( PowerShell pwsh , PowerShellFrameType frameType , RunspaceInfo newRunspaceInfo = null )
365
364
{
366
365
// TODO: Improve runspace origin detection here
367
366
if ( newRunspaceInfo is null )
@@ -379,7 +378,7 @@ private void PushPowerShellAndRunLoop(SMA.PowerShell pwsh, PowerShellFrameType f
379
378
PushPowerShellAndRunLoop ( new PowerShellContextFrame ( pwsh , newRunspaceInfo , frameType ) ) ;
380
379
}
381
380
382
- private RunspaceInfo GetRunspaceInfoForPowerShell ( SMA . PowerShell pwsh , out bool isNewRunspace , out RunspaceFrame oldRunspaceFrame )
381
+ private RunspaceInfo GetRunspaceInfoForPowerShell ( PowerShell pwsh , out bool isNewRunspace , out RunspaceFrame oldRunspaceFrame )
383
382
{
384
383
oldRunspaceFrame = null ;
385
384
0 commit comments