Skip to content

Commit d52caec

Browse files
committed
Send stopDebugger during REPL if no longer debugging
1 parent 20aaa02 commit d52caec

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/PowerShellEditorServices/Services/PowerShell/Host/PsesInternalHost.cs

+9-1
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;
@@ -601,6 +601,14 @@ private void DoOneRepl(CancellationToken cancellationToken)
601601
return;
602602
}
603603

604+
// If we started the debug server, then on each REPL we need to check if we're still
605+
// actively debugging, and if not, stop the server.
606+
if (DebugContext.OwnsDebugServerState && !CurrentRunspace.Runspace.Debugger.InBreakpoint)
607+
{
608+
DebugContext.OwnsDebugServerState = false;
609+
_languageServer?.SendNotification("powerShell/stopDebugger");
610+
}
611+
604612
// When a task must run in the foreground, we cancel out of the idle loop and return to the top level.
605613
// At that point, we would normally run a REPL, but we need to immediately execute the task.
606614
// So we set _skipNextPrompt to do that.

0 commit comments

Comments
 (0)