@@ -73,14 +73,6 @@ protected override void Initialize()
73
73
74
74
protected Task LaunchScript ( RequestContext < object > requestContext )
75
75
{
76
- // If this is a run without debugging session, disable all breakpoints.
77
- if ( this . noDebug )
78
- {
79
- Task disableBreakpointsTask =
80
- this . editorSession . DebugService . DisableAllBreakpoints ( ) ;
81
- Task . WhenAll ( disableBreakpointsTask ) ;
82
- }
83
-
84
76
return editorSession . PowerShellContext
85
77
. ExecuteScriptAtPath ( this . scriptPathToLaunch , this . arguments )
86
78
. ContinueWith (
@@ -235,9 +227,11 @@ protected async Task HandleSetBreakpointsRequest(
235
227
LogLevel . Warning ,
236
228
$ "Attempted to set breakpoints on a non-existing file: { setBreakpointsParams . Source . Path } ") ;
237
229
230
+ string message = this . noDebug ? null : "Source does not exist, breakpoint not set." ;
231
+
238
232
var srcBreakpoints = setBreakpointsParams . Breakpoints
239
233
. Select ( srcBkpt => Protocol . DebugAdapter . Breakpoint . Create (
240
- srcBkpt , setBreakpointsParams . Source . Path , "Source does not exist, breakpoint not set." ) ) ;
234
+ srcBkpt , setBreakpointsParams . Source . Path , message , verified : this . noDebug ) ) ;
241
235
242
236
// Return non-verified breakpoint message.
243
237
await requestContext . SendResult (
@@ -259,16 +253,20 @@ await requestContext.SendResult(
259
253
srcBreakpoint . Condition ) ;
260
254
}
261
255
262
- BreakpointDetails [ ] breakpoints =
263
- await editorSession . DebugService . SetLineBreakpoints (
264
- scriptFile ,
265
- breakpointDetails ) ;
256
+ // If this is a "run without debugging (Ctrl+F5)" session ignore requests to set breakpoints.
257
+ BreakpointDetails [ ] updatedBreakpointDetails = breakpointDetails ;
258
+ if ( ! this . noDebug )
259
+ {
260
+ updatedBreakpointDetails =
261
+ await editorSession . DebugService . SetLineBreakpoints (
262
+ scriptFile ,
263
+ breakpointDetails ) ;
264
+ }
266
265
267
266
await requestContext . SendResult (
268
- new SetBreakpointsResponseBody
269
- {
267
+ new SetBreakpointsResponseBody {
270
268
Breakpoints =
271
- breakpoints
269
+ updatedBreakpointDetails
272
270
. Select ( Protocol . DebugAdapter . Breakpoint . Create )
273
271
. ToArray ( )
274
272
} ) ;
@@ -287,14 +285,19 @@ protected async Task HandleSetFunctionBreakpointsRequest(
287
285
funcBreakpoint . Condition ) ;
288
286
}
289
287
290
- CommandBreakpointDetails [ ] breakpoints =
291
- await editorSession . DebugService . SetCommandBreakpoints (
292
- breakpointDetails ) ;
288
+ // If this is a "run without debugging (Ctrl+F5)" session ignore requests to set breakpoints.
289
+ CommandBreakpointDetails [ ] updatedBreakpointDetails = breakpointDetails ;
290
+ if ( ! this . noDebug )
291
+ {
292
+ updatedBreakpointDetails =
293
+ await editorSession . DebugService . SetCommandBreakpoints (
294
+ breakpointDetails ) ;
295
+ }
293
296
294
297
await requestContext . SendResult (
295
298
new SetBreakpointsResponseBody {
296
299
Breakpoints =
297
- breakpoints
300
+ updatedBreakpointDetails
298
301
. Select ( Protocol . DebugAdapter . Breakpoint . Create )
299
302
. ToArray ( )
300
303
} ) ;
0 commit comments