@@ -23,6 +23,7 @@ public class DebugAdapter : DebugAdapterBase
23
23
private OutputDebouncer outputDebouncer ;
24
24
private bool isConfigurationDoneRequestComplete ;
25
25
private bool isLaunchRequestComplete ;
26
+ private bool noDebug ;
26
27
private string scriptPathToLaunch ;
27
28
private string arguments ;
28
29
@@ -158,6 +159,7 @@ protected async Task HandleLaunchRequest(
158
159
// If the launch request comes first, then stash the launch
159
160
// params so that the subsequent configurationDone request handler
160
161
// can launch the script.
162
+ this . noDebug = launchParams . NoDebug ;
161
163
this . scriptPathToLaunch = launchParams . Program ;
162
164
this . arguments = arguments ;
163
165
@@ -225,9 +227,11 @@ protected async Task HandleSetBreakpointsRequest(
225
227
LogLevel . Warning ,
226
228
$ "Attempted to set breakpoints on a non-existing file: { setBreakpointsParams . Source . Path } ") ;
227
229
230
+ string message = this . noDebug ? string . Empty : "Source does not exist, breakpoint not set." ;
231
+
228
232
var srcBreakpoints = setBreakpointsParams . Breakpoints
229
233
. 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 ) ) ;
231
235
232
236
// Return non-verified breakpoint message.
233
237
await requestContext . SendResult (
@@ -249,16 +253,20 @@ await requestContext.SendResult(
249
253
srcBreakpoint . Condition ) ;
250
254
}
251
255
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
+ }
256
265
257
266
await requestContext . SendResult (
258
- new SetBreakpointsResponseBody
259
- {
267
+ new SetBreakpointsResponseBody {
260
268
Breakpoints =
261
- breakpoints
269
+ updatedBreakpointDetails
262
270
. Select ( Protocol . DebugAdapter . Breakpoint . Create )
263
271
. ToArray ( )
264
272
} ) ;
@@ -277,14 +285,19 @@ protected async Task HandleSetFunctionBreakpointsRequest(
277
285
funcBreakpoint . Condition ) ;
278
286
}
279
287
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
+ }
283
296
284
297
await requestContext . SendResult (
285
298
new SetBreakpointsResponseBody {
286
299
Breakpoints =
287
- breakpoints
300
+ updatedBreakpointDetails
288
301
. Select ( Protocol . DebugAdapter . Breakpoint . Create )
289
302
. ToArray ( )
290
303
} ) ;
0 commit comments