@@ -90,6 +90,10 @@ export class DartDebugSession extends DebugSession {
9090 this . shouldKillProcessOnTerminate = true ;
9191 this . cwd = args . cwd ;
9292 this . noDebug = args . noDebug ;
93+ // Set default exception mode based on noDebug. This will be sent to threads
94+ // prior to VS Code sending (or, in the case of noDebug, due to not sending)
95+ // the exception mode.
96+ this . threadManager . setExceptionPauseMode ( this . noDebug ? "None" : "Unhandled" ) ;
9397 this . packageMap = new PackageMap ( PackageMap . findPackagesFile ( args . program || args . cwd ) ) ;
9498 this . debugSdkLibraries = args . debugSdkLibraries ;
9599 this . debugExternalLibraries = args . debugExternalLibraries ;
@@ -107,7 +111,7 @@ export class DartDebugSession extends DebugSession {
107111 process . stdout . setEncoding ( "utf8" ) ;
108112 process . stdout . on ( "data" , ( data ) => {
109113 let match : RegExpExecArray | null = null ;
110- if ( ! this . noDebug && this . parseObservatoryUriFromStdOut && ! this . observatory ) {
114+ if ( this . parseObservatoryUriFromStdOut && ! this . observatory ) {
111115 match = ObservatoryConnection . bannerRegex . exec ( data . toString ( ) ) ;
112116 }
113117 if ( match ) {
@@ -131,9 +135,6 @@ export class DartDebugSession extends DebugSession {
131135 this . logToUser ( `Exited (${ signal ? `${ signal } ` . toLowerCase ( ) : code } )\n` ) ;
132136 this . sendEvent ( new TerminatedEvent ( ) ) ;
133137 } ) ;
134-
135- if ( args . noDebug )
136- this . sendEvent ( new InitializedEvent ( ) ) ;
137138 }
138139
139140 protected async attachRequest ( response : DebugProtocol . AttachResponse , args : DartAttachRequestArguments ) : Promise < void > {
@@ -177,12 +178,9 @@ export class DartDebugSession extends DebugSession {
177178 }
178179
179180 protected spawnProcess ( args : DartLaunchRequestArguments ) {
180- const debug = ! args . noDebug ;
181181 let appArgs = [ ] ;
182- if ( debug ) {
183- appArgs . push ( "--enable-vm-service=0" ) ;
184- appArgs . push ( "--pause_isolates_on_start=true" ) ;
185- }
182+ appArgs . push ( "--enable-vm-service=0" ) ;
183+ appArgs . push ( "--pause_isolates_on_start=true" ) ;
186184 if ( args . enableAsserts !== false ) { // undefined = on
187185 appArgs . push ( "--enable-asserts" ) ;
188186 }
@@ -255,9 +253,6 @@ export class DartDebugSession extends DebugSession {
255253 vmServiceUri : browserFriendlyUri . toString ( ) ,
256254 } ) ) ;
257255
258- if ( this . noDebug )
259- return ;
260-
261256 return new Promise < void > ( ( resolve , reject ) => {
262257 this . observatory = new ObservatoryConnection ( uri ) ;
263258 this . observatory . onLogging ( ( message ) => this . log ( message ) ) ;
@@ -448,6 +443,12 @@ export class DartDebugSession extends DebugSession {
448443 response : DebugProtocol . SetBreakpointsResponse ,
449444 args : DebugProtocol . SetBreakpointsArguments ,
450445 ) : Promise < void > {
446+ if ( this . noDebug ) {
447+ response . body = { breakpoints : args . breakpoints . map ( ( b ) => ( { verified : false } ) ) } ;
448+ this . sendResponse ( response ) ;
449+ return ;
450+ }
451+
451452 const source : DebugProtocol . Source = args . source ;
452453 let breakpoints : DebugProtocol . SourceBreakpoint [ ] = args . breakpoints ;
453454 if ( ! breakpoints )
@@ -481,10 +482,14 @@ export class DartDebugSession extends DebugSession {
481482 const filters : string [ ] = args . filters ;
482483
483484 let mode : VmExceptionMode = "None" ;
484- if ( filters . indexOf ( "Unhandled" ) !== - 1 )
485- mode = "Unhandled" ;
486- if ( filters . indexOf ( "All" ) !== - 1 )
487- mode = "All" ;
485+
486+ // If we're running in noDebug mode, we'll always set None.
487+ if ( ! this . noDebug ) {
488+ if ( filters . indexOf ( "Unhandled" ) !== - 1 )
489+ mode = "Unhandled" ;
490+ if ( filters . indexOf ( "All" ) !== - 1 )
491+ mode = "All" ;
492+ }
488493
489494 this . threadManager . setExceptionPauseMode ( mode ) ;
490495
@@ -1020,8 +1025,21 @@ export class DartDebugSession extends DebugSession {
10201025 case "requestCoverageUpdate" :
10211026 this . requestCoverageUpdate ( "editor" ) ;
10221027 break ;
1023-
1028+ // Flutter requests that may be sent during test runs or other places
1029+ // that we don't currently support. TODO: Fix this by moving all the
1030+ // service extension stufff out of Flutter to here, and making it not
1031+ // Flutter-specific. This requires sending all service extensions
1032+ // directly to the VM and not via Flutter's run daemon.
1033+ case "checkPlatformOverride" :
1034+ case "checkIsWidgetCreationTracked" :
1035+ case "hotReload" :
1036+ case "hotRestart" :
1037+ // TODO: Get rid of this!
1038+ this . log ( `Ignoring Flutter customRequest ${ request } for non-Flutter-run app` , LogSeverity . Warn ) ;
1039+ this . sendResponse ( response ) ;
1040+ break ;
10241041 default :
1042+ this . log ( `Unknown customRequest ${ request } ` , LogSeverity . Warn ) ;
10251043 super . customRequest ( request , response , args ) ;
10261044 break ;
10271045 }
0 commit comments