@@ -73,14 +73,6 @@ protected override void Initialize()
7373
7474 protected Task LaunchScript ( RequestContext < object > requestContext )
7575 {
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-
8476 return editorSession . PowerShellContext
8577 . ExecuteScriptAtPath ( this . scriptPathToLaunch , this . arguments )
8678 . ContinueWith (
@@ -235,9 +227,11 @@ protected async Task HandleSetBreakpointsRequest(
235227 LogLevel . Warning ,
236228 $ "Attempted to set breakpoints on a non-existing file: { setBreakpointsParams . Source . Path } ") ;
237229
230+ string message = this . noDebug ? null : "Source does not exist, breakpoint not set." ;
231+
238232 var srcBreakpoints = setBreakpointsParams . Breakpoints
239233 . 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 ) ) ;
241235
242236 // Return non-verified breakpoint message.
243237 await requestContext . SendResult (
@@ -259,16 +253,20 @@ await requestContext.SendResult(
259253 srcBreakpoint . Condition ) ;
260254 }
261255
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+ }
266265
267266 await requestContext . SendResult (
268- new SetBreakpointsResponseBody
269- {
267+ new SetBreakpointsResponseBody {
270268 Breakpoints =
271- breakpoints
269+ updatedBreakpointDetails
272270 . Select ( Protocol . DebugAdapter . Breakpoint . Create )
273271 . ToArray ( )
274272 } ) ;
@@ -287,14 +285,19 @@ protected async Task HandleSetFunctionBreakpointsRequest(
287285 funcBreakpoint . Condition ) ;
288286 }
289287
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+ }
293296
294297 await requestContext . SendResult (
295298 new SetBreakpointsResponseBody {
296299 Breakpoints =
297- breakpoints
300+ updatedBreakpointDetails
298301 . Select ( Protocol . DebugAdapter . Breakpoint . Create )
299302 . ToArray ( )
300303 } ) ;
0 commit comments