@@ -101,10 +101,7 @@ export class LocalDebugClient extends DebugClient<LaunchRequestArguments> {
101101 if ( typeof this . args . pythonPath === 'string' && this . args . pythonPath . trim ( ) . length > 0 ) {
102102 pythonPath = this . args . pythonPath ;
103103 }
104- const ptVSToolsFilePath = this . launcherScriptProvider . getLauncherFilePath ( ) ;
105- const launcherArgs = this . buildLauncherArguments ( ) ;
106-
107- const args = [ ptVSToolsFilePath , processCwd , dbgServer . port . toString ( ) , '34806ad9-833a-4524-8cd6-18ca4aa74f14' ] . concat ( launcherArgs ) ;
104+ const args = this . buildLaunchArguments ( processCwd , dbgServer . port ) ;
108105 switch ( this . args . console ) {
109106 case 'externalTerminal' :
110107 case 'integratedTerminal' : {
@@ -161,8 +158,13 @@ export class LocalDebugClient extends DebugClient<LaunchRequestArguments> {
161158 let x = 0 ;
162159 } ) ;
163160 }
161+ private buildLaunchArguments ( cwd : string , debugPort : number ) : string [ ] {
162+ return [ ...this . buildDebugArguments ( cwd , debugPort ) , ...this . buildStandardArguments ( ) ] ;
163+ }
164+
164165 // tslint:disable-next-line:member-ordering
165- protected buildLauncherArguments ( ) : string [ ] {
166+ protected buildDebugArguments ( cwd : string , debugPort : number ) : string [ ] {
167+ const ptVSToolsFilePath = this . launcherScriptProvider . getLauncherFilePath ( ) ;
166168 const vsDebugOptions : string [ ] = [ DebugOptions . RedirectOutput ] ;
167169 if ( Array . isArray ( this . args . debugOptions ) ) {
168170 this . args . debugOptions . filter ( opt => VALID_DEBUG_OPTIONS . indexOf ( opt ) >= 0 )
@@ -173,15 +175,18 @@ export class LocalDebugClient extends DebugClient<LaunchRequestArguments> {
173175 if ( djangoIndex >= 0 ) {
174176 vsDebugOptions [ djangoIndex ] = 'DjangoDebugging' ;
175177 }
178+ return [ ptVSToolsFilePath , cwd , debugPort . toString ( ) , '34806ad9-833a-4524-8cd6-18ca4aa74f14' , vsDebugOptions . join ( ',' ) ] ;
179+ }
180+ // tslint:disable-next-line:member-ordering
181+ protected buildStandardArguments ( ) {
176182 const programArgs = Array . isArray ( this . args . args ) && this . args . args . length > 0 ? this . args . args : [ ] ;
177183 if ( typeof this . args . module === 'string' && this . args . module . length > 0 ) {
178- return [ vsDebugOptions . join ( ',' ) , ' -m', this . args . module ] . concat ( programArgs ) ;
184+ return [ ' -m', this . args . module , ... programArgs ] ;
179185 }
180- const args = [ vsDebugOptions . join ( ',' ) ] ;
181186 if ( this . args . program && this . args . program . length > 0 ) {
182- args . push ( this . args . program ) ;
187+ return [ this . args . program , ... programArgs ] ;
183188 }
184- return args . concat ( programArgs ) ;
189+ return programArgs ;
185190 }
186191 private launchExternalTerminal ( sudo : boolean , cwd : string , pythonPath : string , args : string [ ] , env : { } ) {
187192 return new Promise ( ( resolve , reject ) => {
0 commit comments