Skip to content

Commit 905686c

Browse files
committed
Move execution service to an interface
1 parent f5b644e commit 905686c

28 files changed

+142
-145
lines changed

src/PowerShellEditorServices/Server/PsesServiceCollectionExtensions.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ public static IServiceCollection AddPsesLanguageServices(
3131
.AddSingleton<PsesInternalHost>()
3232
.AddSingleton<IRunspaceContext>(
3333
(provider) => provider.GetService<PsesInternalHost>())
34-
.AddSingleton<PowerShellExecutionService>()
34+
.AddSingleton<IInternalPowerShellExecutionService>(
35+
(provider) => provider.GetService<PsesInternalHost>())
3536
.AddSingleton<ConfigurationService>()
3637
.AddSingleton<IPowerShellDebugContext>(
3738
(provider) => provider.GetService<PsesInternalHost>().DebugContext)
@@ -44,7 +45,7 @@ public static IServiceCollection AddPsesLanguageServices(
4445
provider.GetService<ILanguageServerFacade>(),
4546
provider,
4647
provider.GetService<EditorOperationsService>(),
47-
provider.GetService<PowerShellExecutionService>());
48+
provider.GetService<IInternalPowerShellExecutionService>());
4849

4950
// This is where we create the $psEditor variable
5051
// so that when the console is ready, it will be available
@@ -70,7 +71,7 @@ public static IServiceCollection AddPsesDebugServices(
7071
.AddSingleton<PsesInternalHost>(internalHost)
7172
.AddSingleton<IRunspaceContext>(internalHost)
7273
.AddSingleton<IPowerShellDebugContext>(internalHost.DebugContext)
73-
.AddSingleton(languageServiceProvider.GetService<PowerShellExecutionService>())
74+
.AddSingleton(languageServiceProvider.GetService<IInternalPowerShellExecutionService>())
7475
.AddSingleton(languageServiceProvider.GetService<WorkspaceService>())
7576
.AddSingleton(languageServiceProvider.GetService<RemoteFileManagerService>())
7677
.AddSingleton<PsesDebugServer>(psesDebugServer)

src/PowerShellEditorServices/Services/DebugAdapter/BreakpointService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace Microsoft.PowerShell.EditorServices.Services
1919
internal class BreakpointService
2020
{
2121
private readonly ILogger<BreakpointService> _logger;
22-
private readonly PowerShellExecutionService _executionService;
22+
private readonly IInternalPowerShellExecutionService _executionService;
2323
private readonly PsesInternalHost _editorServicesHost;
2424
private readonly DebugStateService _debugStateService;
2525

@@ -32,7 +32,7 @@ internal class BreakpointService
3232

3333
public BreakpointService(
3434
ILoggerFactory factory,
35-
PowerShellExecutionService executionService,
35+
IInternalPowerShellExecutionService executionService,
3636
PsesInternalHost editorServicesHost,
3737
DebugStateService debugStateService)
3838
{

src/PowerShellEditorServices/Services/DebugAdapter/DebugEventHandlerService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace Microsoft.PowerShell.EditorServices.Services
1717
internal class DebugEventHandlerService
1818
{
1919
private readonly ILogger<DebugEventHandlerService> _logger;
20-
private readonly PowerShellExecutionService _executionService;
20+
private readonly IInternalPowerShellExecutionService _executionService;
2121
private readonly DebugService _debugService;
2222
private readonly DebugStateService _debugStateService;
2323
private readonly IDebugAdapterServerFacade _debugAdapterServer;
@@ -26,7 +26,7 @@ internal class DebugEventHandlerService
2626

2727
public DebugEventHandlerService(
2828
ILoggerFactory factory,
29-
PowerShellExecutionService executionService,
29+
IInternalPowerShellExecutionService executionService,
3030
DebugService debugService,
3131
DebugStateService debugStateService,
3232
IDebugAdapterServerFacade debugAdapterServer,

src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ internal class DebugService
3434
private readonly BreakpointDetails[] s_emptyBreakpointDetailsArray = Array.Empty<BreakpointDetails>();
3535

3636
private readonly ILogger _logger;
37-
private readonly PowerShellExecutionService _executionService;
37+
private readonly IInternalPowerShellExecutionService _executionService;
3838
private readonly BreakpointService _breakpointService;
3939
private readonly RemoteFileManagerService remoteFileManager;
4040

@@ -104,7 +104,7 @@ internal class DebugService
104104
//// </param>
105105
/// <param name="logger">An ILogger implementation used for writing log messages.</param>
106106
public DebugService(
107-
PowerShellExecutionService executionService,
107+
IInternalPowerShellExecutionService executionService,
108108
IPowerShellDebugContext debugContext,
109109
RemoteFileManagerService remoteFileManager,
110110
BreakpointService breakpointService,

src/PowerShellEditorServices/Services/DebugAdapter/Handlers/ConfigurationDoneHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ internal class ConfigurationDoneHandler : IConfigurationDoneHandler
3838
private readonly DebugService _debugService;
3939
private readonly DebugStateService _debugStateService;
4040
private readonly DebugEventHandlerService _debugEventHandlerService;
41-
private readonly PowerShellExecutionService _executionService;
41+
private readonly IInternalPowerShellExecutionService _executionService;
4242
private readonly WorkspaceService _workspaceService;
4343

4444
private readonly IPowerShellDebugContext _debugContext;
@@ -50,7 +50,7 @@ public ConfigurationDoneHandler(
5050
DebugService debugService,
5151
DebugStateService debugStateService,
5252
DebugEventHandlerService debugEventHandlerService,
53-
PowerShellExecutionService executionService,
53+
IInternalPowerShellExecutionService executionService,
5454
WorkspaceService workspaceService,
5555
IPowerShellDebugContext debugContext,
5656
IRunspaceContext runspaceContext)

src/PowerShellEditorServices/Services/DebugAdapter/Handlers/DebugEvaluateHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ internal class DebugEvaluateHandler : IEvaluateHandler
1919
{
2020
private readonly ILogger _logger;
2121
private readonly IPowerShellDebugContext _debugContext;
22-
private readonly PowerShellExecutionService _executionService;
22+
private readonly IInternalPowerShellExecutionService _executionService;
2323
private readonly DebugService _debugService;
2424

2525
public DebugEvaluateHandler(
2626
ILoggerFactory factory,
2727
IPowerShellDebugContext debugContext,
28-
PowerShellExecutionService executionService,
28+
IInternalPowerShellExecutionService executionService,
2929
DebugService debugService)
3030
{
3131
_logger = factory.CreateLogger<DebugEvaluateHandler>();

src/PowerShellEditorServices/Services/DebugAdapter/Handlers/DisconnectHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace Microsoft.PowerShell.EditorServices.Handlers
2020
internal class DisconnectHandler : IDisconnectHandler
2121
{
2222
private readonly ILogger<DisconnectHandler> _logger;
23-
private readonly PowerShellExecutionService _executionService;
23+
private readonly IInternalPowerShellExecutionService _executionService;
2424
private readonly DebugService _debugService;
2525
private readonly DebugStateService _debugStateService;
2626
private readonly DebugEventHandlerService _debugEventHandlerService;
@@ -31,7 +31,7 @@ public DisconnectHandler(
3131
ILoggerFactory factory,
3232
PsesDebugServer psesDebugServer,
3333
IRunspaceContext runspaceContext,
34-
PowerShellExecutionService executionService,
34+
IInternalPowerShellExecutionService executionService,
3535
DebugService debugService,
3636
DebugStateService debugStateService,
3737
DebugEventHandlerService debugEventHandlerService)

src/PowerShellEditorServices/Services/DebugAdapter/Handlers/LaunchAndAttachHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ internal class LaunchAndAttachHandler : ILaunchHandler<PsesLaunchRequestArgument
9292
private readonly BreakpointService _breakpointService;
9393
private readonly DebugService _debugService;
9494
private readonly IRunspaceContext _runspaceContext;
95-
private readonly PowerShellExecutionService _executionService;
95+
private readonly IInternalPowerShellExecutionService _executionService;
9696
private readonly DebugStateService _debugStateService;
9797
private readonly DebugEventHandlerService _debugEventHandlerService;
9898
private readonly IDebugAdapterServerFacade _debugAdapterServer;
@@ -105,7 +105,7 @@ public LaunchAndAttachHandler(
105105
DebugEventHandlerService debugEventHandlerService,
106106
DebugService debugService,
107107
IRunspaceContext runspaceContext,
108-
PowerShellExecutionService executionService,
108+
IInternalPowerShellExecutionService executionService,
109109
DebugStateService debugStateService,
110110
RemoteFileManagerService remoteFileManagerService)
111111
{

src/PowerShellEditorServices/Services/Extension/EditorOperationsService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ internal class EditorOperationsService : IEditorOperations
2121

2222
private readonly ILanguageServerFacade _languageServer;
2323

24-
private readonly PowerShellExecutionService _executionService;
24+
private readonly IInternalPowerShellExecutionService _executionService;
2525

2626
public EditorOperationsService(
2727
PsesInternalHost psesHost,
2828
WorkspaceService workspaceService,
29-
PowerShellExecutionService executionService,
29+
IInternalPowerShellExecutionService executionService,
3030
ILanguageServerFacade languageServer)
3131
{
3232
_psesHost = psesHost;

src/PowerShellEditorServices/Services/Extension/ExtensionService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ internal sealed class ExtensionService
5050
/// <summary>
5151
/// Gets the PowerShellContext in which extension code will be executed.
5252
/// </summary>
53-
internal PowerShellExecutionService ExecutionService { get; private set; }
53+
internal IInternalPowerShellExecutionService ExecutionService { get; private set; }
5454

5555
#endregion
5656

@@ -68,7 +68,7 @@ internal ExtensionService(
6868
ILanguageServerFacade languageServer,
6969
IServiceProvider serviceProvider,
7070
IEditorOperations editorOperations,
71-
PowerShellExecutionService executionService)
71+
IInternalPowerShellExecutionService executionService)
7272
{
7373
ExecutionService = executionService;
7474
_languageServer = languageServer;

src/PowerShellEditorServices/Services/PowerShell/Debugging/DscBreakpointCapability.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ internal class DscBreakpointCapability
2929
new Dictionary<string, int[]>();
3030

3131
public async Task<BreakpointDetails[]> SetLineBreakpointsAsync(
32-
PowerShellExecutionService executionService,
32+
IInternalPowerShellExecutionService executionService,
3333
string scriptPath,
3434
BreakpointDetails[] breakpoints)
3535
{

src/PowerShellEditorServices/Services/PowerShell/Handlers/EvaluateHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ namespace Microsoft.PowerShell.EditorServices.Handlers
1717
internal class EvaluateHandler : IEvaluateHandler
1818
{
1919
private readonly ILogger _logger;
20-
private readonly PowerShellExecutionService _executionService;
20+
private readonly IInternalPowerShellExecutionService _executionService;
2121

2222
public EvaluateHandler(
2323
ILoggerFactory factory,
24-
PowerShellExecutionService executionService)
24+
IInternalPowerShellExecutionService executionService)
2525
{
2626
_logger = factory.CreateLogger<EvaluateHandler>();
2727
_executionService = executionService;

src/PowerShellEditorServices/Services/PowerShell/Handlers/ExpandAliasHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ internal class ExpandAliasResult
3030
internal class ExpandAliasHandler : IExpandAliasHandler
3131
{
3232
private readonly ILogger _logger;
33-
private readonly PowerShellExecutionService _executionService;
33+
private readonly IInternalPowerShellExecutionService _executionService;
3434

35-
public ExpandAliasHandler(ILoggerFactory factory, PowerShellExecutionService executionService)
35+
public ExpandAliasHandler(ILoggerFactory factory, IInternalPowerShellExecutionService executionService)
3636
{
3737
_logger = factory.CreateLogger<ExpandAliasHandler>();
3838
_executionService = executionService;

src/PowerShellEditorServices/Services/PowerShell/Handlers/GetCommandHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ internal class PSCommandMessage
3535
internal class GetCommandHandler : IGetCommandHandler
3636
{
3737
private readonly ILogger<GetCommandHandler> _logger;
38-
private readonly PowerShellExecutionService _executionService;
38+
private readonly IInternalPowerShellExecutionService _executionService;
3939

40-
public GetCommandHandler(ILoggerFactory factory, PowerShellExecutionService executionService)
40+
public GetCommandHandler(ILoggerFactory factory, IInternalPowerShellExecutionService executionService)
4141
{
4242
_logger = factory.CreateLogger<GetCommandHandler>();
4343
_executionService = executionService;

src/PowerShellEditorServices/Services/PowerShell/Handlers/GetVersionHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ internal class GetVersionHandler : IGetVersionHandler
2626

2727
private readonly ILogger<GetVersionHandler> _logger;
2828
private IRunspaceContext _runspaceContext;
29-
private readonly PowerShellExecutionService _executionService;
29+
private readonly IInternalPowerShellExecutionService _executionService;
3030
private readonly ILanguageServerFacade _languageServer;
3131
private readonly ConfigurationService _configurationService;
3232

3333
public GetVersionHandler(
3434
ILoggerFactory factory,
3535
IRunspaceContext runspaceContext,
36-
PowerShellExecutionService executionService,
36+
IInternalPowerShellExecutionService executionService,
3737
ILanguageServerFacade languageServer,
3838
ConfigurationService configurationService)
3939
{

src/PowerShellEditorServices/Services/PowerShell/Handlers/PSHostProcessAndRunspaceHandlers.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ namespace Microsoft.PowerShell.EditorServices.Handlers
1818
internal class PSHostProcessAndRunspaceHandlers : IGetPSHostProcessesHandler, IGetRunspaceHandler
1919
{
2020
private readonly ILogger<PSHostProcessAndRunspaceHandlers> _logger;
21-
private readonly PowerShellExecutionService _executionService;
21+
private readonly IInternalPowerShellExecutionService _executionService;
2222

23-
public PSHostProcessAndRunspaceHandlers(ILoggerFactory factory, PowerShellExecutionService executionService)
23+
public PSHostProcessAndRunspaceHandlers(ILoggerFactory factory, IInternalPowerShellExecutionService executionService)
2424
{
2525
_logger = factory.CreateLogger<PSHostProcessAndRunspaceHandlers>();
2626
_executionService = executionService;

src/PowerShellEditorServices/Services/PowerShell/Handlers/ShowHelpHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ internal class ShowHelpParams : IRequest
2424
internal class ShowHelpHandler : IShowHelpHandler
2525
{
2626
private readonly ILogger _logger;
27-
private readonly PowerShellExecutionService _executionService;
27+
private readonly IInternalPowerShellExecutionService _executionService;
2828

29-
public ShowHelpHandler(ILoggerFactory factory, PowerShellExecutionService executionService)
29+
public ShowHelpHandler(ILoggerFactory factory, IInternalPowerShellExecutionService executionService)
3030
{
3131
_logger = factory.CreateLogger<ShowHelpHandler>();
3232
_executionService = executionService;

0 commit comments

Comments
 (0)