@@ -139,17 +139,14 @@ export class WebKitDebugAdapter implements DebugProtocol.IDebugAdapter {
139139 return Services . extensionClient ( ) . getInitSettings ( ) . then ( settings => {
140140 Services . cliPath = settings . tnsPath || Services . cliPath ;
141141 this . _request = new DebugRequest ( args , Services . cli ( ) ) ;
142- Services . extensionClient ( ) . analyticsLaunchDebugger ( { request : this . _request . isSync ? "sync" : args . request , platform : args . platform } ) ;
142+ Services . extensionClient ( ) . analyticsLaunchDebugger ( { request : args . request , platform : args . platform } ) ;
143143
144144 // Run CLI Command
145- Services . logger ( ) . log ( `[NSDebugAdapter] Using tns CLI on path '${ this . _request . project . cli . path } '` , Tags . FrontendMessage ) ;
145+ Services . logger ( ) . log ( `[NSDebugAdapter] Using tns CLI v ${ this . _request . project . cli . version } on path '${ this . _request . project . cli . path } '` , Tags . FrontendMessage ) ;
146146 Services . logger ( ) . log ( '[NSDebugAdapter] Running tns command...' , Tags . FrontendMessage ) ;
147147 let cliCommand : DebugResult ;
148148 if ( this . _request . isLaunch ) {
149- cliCommand = this . _request . project . debug ( { stopOnEntry : this . _request . launchArgs . stopOnEntry } , this . _request . args . tnsArgs ) ;
150- }
151- else if ( this . _request . isSync ) {
152- cliCommand = this . _request . project . debugWithSync ( { stopOnEntry : this . _request . launchArgs . stopOnEntry , syncAllFiles : this . _request . launchArgs . syncAllFiles } , this . _request . args . tnsArgs ) ;
149+ cliCommand = this . _request . project . debug ( { stopOnEntry : this . _request . launchArgs . stopOnEntry , watch : this . _request . launchArgs . watch } , this . _request . args . tnsArgs ) ;
153150 }
154151 else if ( this . _request . isAttach ) {
155152 cliCommand = this . _request . project . attach ( this . _request . args . tnsArgs ) ;
@@ -158,33 +155,30 @@ export class WebKitDebugAdapter implements DebugProtocol.IDebugAdapter {
158155 if ( cliCommand . tnsProcess ) {
159156 cliCommand . tnsProcess . stdout . on ( 'data' , data => { Services . logger ( ) . log ( data . toString ( ) , Tags . FrontendMessage ) ; } ) ;
160157 cliCommand . tnsProcess . stderr . on ( 'data' , data => { Services . logger ( ) . error ( data . toString ( ) , Tags . FrontendMessage ) ; } ) ;
161- cliCommand . tnsProcess . on ( 'close' , ( code , signal ) => { Services . logger ( ) . error ( `The tns command finished its execution with code ${ code } .` , Tags . FrontendMessage ) ; } ) ;
158+ cliCommand . tnsProcess . on ( 'close' , ( code , signal ) => { Services . logger ( ) . error ( `[NSDebugAdapter] The tns command finished its execution with code ${ code } .` , Tags . FrontendMessage ) ; } ) ;
162159 }
163160
164161 let promiseResolve = null ;
165162 let promise : Promise < void > = new Promise < void > ( ( res , rej ) => { promiseResolve = res ; } ) ;
166163 Services . logger ( ) . log ( '[NSDebugAdapter] Watching the tns CLI output to receive a connection token' , Tags . FrontendMessage ) ;
167164 // Attach to the running application
168165 cliCommand . tnsOutputEventEmitter . on ( 'readyForConnection' , ( connectionToken : string | number ) => {
169- connectionToken = this . _request . isAndroid ? this . _request . androidProject . getDebugPortSync ( this . _request . args . tnsArgs ) : connectionToken ;
170- Services . logger ( ) . log ( `[NSDebugAdapter] Attaching to application on ${ connectionToken } ` , Tags . FrontendMessage ) ;
166+ Services . logger ( ) . log ( `[NSDebugAdapter] Ready to attach to application on ${ connectionToken } ` , Tags . FrontendMessage ) ;
171167 let connection : INSDebugConnection = this . _request . isAndroid ? new AndroidConnection ( ) : new IosConnection ( ) ;
172168
173169 connection . attach ( connectionToken , 'localhost' ) . then ( ( ) => {
170+ Services . logger ( ) . log ( `[NSDebugAdapter] Connection to target application established on ${ connectionToken } ` , Tags . FrontendMessage ) ;
174171 this . setConnection ( connection ) ;
175172 return connection . enable ( ) ;
176173 } ) . then ( ( ) => {
177- Services . logger ( ) . log ( `[NSDebugAdapter] Successfully attached to the target application' ` , Tags . FrontendMessage ) ;
174+ Services . logger ( ) . log ( `[NSDebugAdapter] Connection to target application successfully enabled ` , Tags . FrontendMessage ) ;
178175 this . fireEvent ( new InitializedEvent ( ) ) ;
179176 promiseResolve ( ) ;
180- } ) . then ( ( ) => {
181-
182- } ) ;
177+ } ) . then ( ( ) => { } ) ;
183178 } ) ;
184179
185180 return promise ;
186181 } ) ;
187-
188182 }
189183
190184 private setConnection ( connection : INSDebugConnection ) : INSDebugConnection {
@@ -216,8 +210,8 @@ export class WebKitDebugAdapter implements DebugProtocol.IDebugAdapter {
216210 private terminateSession ( ) : void {
217211 this . clearEverything ( ) ;
218212 // In case of a sync request the session is not terminated when the backend is detached
219- if ( ! this . _request . isSync ) {
220- Services . logger ( ) . log ( "Terminating debug session" ) ;
213+ if ( ! this . _request . isLaunch || ! this . _request . launchArgs . watch ) {
214+ Services . logger ( ) . log ( "[NSDebugAdapter] Terminating debug session" ) ;
221215 this . fireEvent ( new TerminatedEvent ( ) ) ;
222216 }
223217 }
0 commit comments