@@ -23,6 +23,7 @@ public class DebugAdapter : DebugAdapterBase
2323 private OutputDebouncer outputDebouncer ;
2424 private bool isConfigurationDoneRequestComplete ;
2525 private bool isLaunchRequestComplete ;
26+ private bool noDebug ;
2627 private string scriptPathToLaunch ;
2728 private string arguments ;
2829
@@ -158,6 +159,7 @@ protected async Task HandleLaunchRequest(
158159 // If the launch request comes first, then stash the launch
159160 // params so that the subsequent configurationDone request handler
160161 // can launch the script.
162+ this . noDebug = launchParams . NoDebug ;
161163 this . scriptPathToLaunch = launchParams . Program ;
162164 this . arguments = arguments ;
163165
@@ -225,9 +227,11 @@ protected async Task HandleSetBreakpointsRequest(
225227 LogLevel . Warning ,
226228 $ "Attempted to set breakpoints on a non-existing file: { setBreakpointsParams . Source . Path } ") ;
227229
230+ string message = this . noDebug ? string . Empty : "Source does not exist, breakpoint not set." ;
231+
228232 var srcBreakpoints = setBreakpointsParams . Breakpoints
229233 . Select ( srcBkpt => Protocol . DebugAdapter . Breakpoint . Create (
230- srcBkpt , setBreakpointsParams . Source . Path , "Source does not exist, breakpoint not set." ) ) ;
234+ srcBkpt , setBreakpointsParams . Source . Path , message , verified : this . noDebug ) ) ;
231235
232236 // Return non-verified breakpoint message.
233237 await requestContext . SendResult (
@@ -249,16 +253,20 @@ await requestContext.SendResult(
249253 srcBreakpoint . Condition ) ;
250254 }
251255
252- BreakpointDetails [ ] breakpoints =
253- await editorSession . DebugService . SetLineBreakpoints (
254- scriptFile ,
255- 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+ }
256265
257266 await requestContext . SendResult (
258- new SetBreakpointsResponseBody
259- {
267+ new SetBreakpointsResponseBody {
260268 Breakpoints =
261- breakpoints
269+ updatedBreakpointDetails
262270 . Select ( Protocol . DebugAdapter . Breakpoint . Create )
263271 . ToArray ( )
264272 } ) ;
@@ -277,14 +285,19 @@ protected async Task HandleSetFunctionBreakpointsRequest(
277285 funcBreakpoint . Condition ) ;
278286 }
279287
280- CommandBreakpointDetails [ ] breakpoints =
281- await editorSession . DebugService . SetCommandBreakpoints (
282- 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+ }
283296
284297 await requestContext . SendResult (
285298 new SetBreakpointsResponseBody {
286299 Breakpoints =
287- breakpoints
300+ updatedBreakpointDetails
288301 . Select ( Protocol . DebugAdapter . Breakpoint . Create )
289302 . ToArray ( )
290303 } ) ;
0 commit comments