1
- // Copyright (c) Microsoft Corporation.
1
+ // Copyright (c) Microsoft Corporation.
2
2
// Licensed under the MIT License.
3
3
4
4
using Microsoft . Extensions . Logging ;
@@ -70,33 +70,30 @@ public Task<ConfigurationDoneResponse> Handle(ConfigurationDoneArguments request
70
70
71
71
if ( _debugStateService . OwnsEditorSession )
72
72
{
73
- // If this is a debug-only session, we need to start
74
- // the command loop manually
73
+ // TODO: If this is a debug-only session, we need to start the command loop manually
74
+ //
75
75
//_powerShellContextService.ConsoleReader.StartCommandLoop();
76
76
}
77
77
78
78
if ( ! string . IsNullOrEmpty ( _debugStateService . ScriptToLaunch ) )
79
79
{
80
- LaunchScriptAsync ( _debugStateService . ScriptToLaunch )
81
- . HandleErrorsAsync ( _logger ) ;
80
+ LaunchScriptAsync ( _debugStateService . ScriptToLaunch ) . HandleErrorsAsync ( _logger ) ;
82
81
}
83
82
84
- if ( _debugStateService . IsInteractiveDebugSession )
83
+ if ( _debugStateService . IsInteractiveDebugSession && _debugService . IsDebuggerStopped )
85
84
{
86
- if ( _debugService . IsDebuggerStopped )
85
+ if ( _debugService . CurrentDebuggerStoppedEventArgs is not null )
87
86
{
88
- if ( _debugService . CurrentDebuggerStoppedEventArgs != null )
89
- {
90
- // If this is an interactive session and there's a pending breakpoint,
91
- // send that information along to the debugger client
92
- _debugEventHandlerService . TriggerDebuggerStopped ( _debugService . CurrentDebuggerStoppedEventArgs ) ;
93
- }
94
- else
95
- {
96
- // If this is an interactive session and there's a pending breakpoint that has not been propagated through
97
- // the debug service, fire the debug service's OnDebuggerStop event.
98
- _debugService . OnDebuggerStopAsync ( null , _debugContext . LastStopEventArgs ) ;
99
- }
87
+ // If this is an interactive session and there's a pending breakpoint, send that
88
+ // information along to the debugger client.
89
+ _debugEventHandlerService . TriggerDebuggerStopped ( _debugService . CurrentDebuggerStoppedEventArgs ) ;
90
+ }
91
+ else
92
+ {
93
+ // If this is an interactive session and there's a pending breakpoint that has
94
+ // not been propagated through the debug service, fire the debug service's
95
+ // OnDebuggerStop event.
96
+ _debugService . OnDebuggerStopAsync ( null , _debugContext . LastStopEventArgs ) ;
100
97
}
101
98
}
102
99
@@ -119,6 +116,8 @@ private async Task LaunchScriptAsync(string scriptToLaunch)
119
116
ScriptBlockAst ast = Parser . ParseInput ( untitledScript . Contents , untitledScript . DocumentUri . ToString ( ) , out Token [ ] tokens , out ParseError [ ] errors ) ;
120
117
121
118
// This seems to be the simplest way to invoke a script block (which contains breakpoint information) via the PowerShell API.
119
+ //
120
+ // TODO: Fix this so the added script doesn't show up.
122
121
var cmd = new PSCommand ( ) . AddScript ( ". $args[0]" ) . AddArgument ( ast . GetScriptBlock ( ) ) ;
123
122
await _executionService
124
123
. ExecutePSCommandAsync < object > ( cmd , CancellationToken . None , s_debuggerExecutionOptions )
0 commit comments