Skip to content

Commit fcb910e

Browse files
committed
Remove DebugStateService.OwnsEditorSession
Since the pipeline rewrite, it is no longer necessary for the `ConfigurationDoneHandler` to manually start the debug loop when temporary consoles are created for debug sessions. Because of this, we can stop plumbing this information all the way through from the top.
1 parent 7e22c88 commit fcb910e

File tree

5 files changed

+4
-23
lines changed

5 files changed

+4
-23
lines changed

src/PowerShellEditorServices/Hosting/EditorServicesServerFactory.cs

-3
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ public PsesDebugServer CreateDebugServerWithLanguageServer(
119119
inputStream,
120120
outputStream,
121121
languageServer.LanguageServer.Services,
122-
useTempSession: false,
123122
usePSReadLine);
124123
}
125124

@@ -144,7 +143,6 @@ public PsesDebugServer RecreateDebugServer(
144143
inputStream,
145144
outputStream,
146145
debugServer.ServiceProvider,
147-
useTempSession: false,
148146
usePSReadLine);
149147
}
150148

@@ -184,7 +182,6 @@ public PsesDebugServer CreateDebugServerForTempSession(
184182
inputStream,
185183
outputStream,
186184
serviceProvider,
187-
useTempSession: true,
188185
usePSReadLine: hostStartupInfo.ConsoleReplEnabled && !hostStartupInfo.UsesLegacyReadLine);
189186
}
190187

src/PowerShellEditorServices/Server/PsesDebugServer.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ internal class PsesDebugServer : IDisposable
2323
{
2424
private readonly Stream _inputStream;
2525
private readonly Stream _outputStream;
26-
private readonly bool _useTempSession;
2726
private readonly bool _usePSReadLine;
2827
private readonly TaskCompletionSource<bool> _serverStopped;
2928

@@ -40,14 +39,12 @@ public PsesDebugServer(
4039
Stream inputStream,
4140
Stream outputStream,
4241
IServiceProvider serviceProvider,
43-
bool useTempSession,
4442
bool usePSReadLine)
4543
{
4644
_loggerFactory = factory;
4745
_inputStream = inputStream;
4846
_outputStream = outputStream;
4947
ServiceProvider = serviceProvider;
50-
_useTempSession = useTempSession;
5148
_serverStopped = new TaskCompletionSource<bool>();
5249
_usePSReadLine = usePSReadLine;
5350
}
@@ -74,7 +71,7 @@ public async Task StartAsync()
7471
serviceCollection
7572
.AddLogging()
7673
.AddOptions()
77-
.AddPsesDebugServices(ServiceProvider, this, _useTempSession))
74+
.AddPsesDebugServices(ServiceProvider, this))
7875
// TODO: Consider replacing all WithHandler with AddSingleton
7976
.WithHandler<LaunchAndAttachHandler>()
8077
.WithHandler<DisconnectHandler>()

src/PowerShellEditorServices/Server/PsesServiceCollectionExtensions.cs

+2-6
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ public static IServiceCollection AddPsesLanguageServices(
5959
public static IServiceCollection AddPsesDebugServices(
6060
this IServiceCollection collection,
6161
IServiceProvider languageServiceProvider,
62-
PsesDebugServer psesDebugServer,
63-
bool useTempSession)
62+
PsesDebugServer psesDebugServer)
6463
{
6564
PsesInternalHost internalHost = languageServiceProvider.GetService<PsesInternalHost>();
6665

@@ -74,10 +73,7 @@ public static IServiceCollection AddPsesDebugServices(
7473
.AddSingleton<PsesDebugServer>(psesDebugServer)
7574
.AddSingleton<DebugService>()
7675
.AddSingleton<BreakpointService>()
77-
.AddSingleton<DebugStateService>(new DebugStateService
78-
{
79-
OwnsEditorSession = useTempSession
80-
})
76+
.AddSingleton<DebugStateService>()
8177
.AddSingleton<DebugEventHandlerService>();
8278
}
8379
}

src/PowerShellEditorServices/Services/DebugAdapter/DebugStateService.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation.
1+
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

44
using System.Threading;
@@ -25,8 +25,6 @@ internal class DebugStateService
2525

2626
internal string ScriptToLaunch { get; set; }
2727

28-
internal bool OwnsEditorSession { get; set; }
29-
3028
internal bool ExecutionCompleted { get; set; }
3129

3230
internal bool IsInteractiveDebugSession { get; set; }

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

-7
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,6 @@ public Task<ConfigurationDoneResponse> Handle(ConfigurationDoneArguments request
6868
{
6969
_debugService.IsClientAttached = true;
7070

71-
if (_debugStateService.OwnsEditorSession)
72-
{
73-
// TODO: If this is a debug-only session, we need to start the command loop manually
74-
//
75-
//_powerShellContextService.ConsoleReader.StartCommandLoop();
76-
}
77-
7871
if (!string.IsNullOrEmpty(_debugStateService.ScriptToLaunch))
7972
{
8073
// NOTE: This is an unawaited task because responding to "configuration done" means

0 commit comments

Comments
 (0)