@@ -419,9 +419,16 @@ export function addTasksJsonIfNecessary(generator: AssetGenerator, operations: O
419419 return resolve ( ) ;
420420 }
421421
422+ // Read existing Tasks configuration
423+ const tasksConfigs = vscode . workspace . getConfiguration ( 'tasks' ) ;
424+ let existingTaskConfigs = tasksConfigs . get < Array < tasks . TaskDescription > > ( 'tasks' ) ;
422425 const tasksJson = generator . createTasksConfiguration ( ) ;
423- const tasksJsonText = JSON . stringify ( tasksJson , null , ' ' ) ;
424426
427+ if ( existingTaskConfigs ) {
428+ tasksJson [ 'tasks' ] = tasksJson [ 'tasks' ] . concat ( existingTaskConfigs ) ;
429+ }
430+
431+ const tasksJsonText = JSON . stringify ( tasksJson , null , ' ' ) ;
425432 fs . writeFile ( generator . tasksJsonPath , tasksJsonText , err => {
426433 if ( err ) {
427434 return reject ( err ) ;
@@ -442,11 +449,27 @@ function addLaunchJsonIfNecessary(generator: AssetGenerator, operations: Operati
442449 return resolve ( ) ;
443450 }
444451
452+ // Read existing launch configuration
453+ const launchConfigs = vscode . workspace . getConfiguration ( 'launch' ) ;
454+ let existingLaunchConfigs = launchConfigs . get < { } [ ] > ( 'configurations' ) ;
455+
445456 const isWebProject = generator . hasWebServerDependency ( ) ;
446- const launchJson : string = generator . createLaunchJson ( isWebProject ) ;
457+ let launchJson : string = generator . createLaunchJson ( isWebProject ) ;
458+
459+ if ( existingLaunchConfigs ) {
460+ let existingLaunchConfigsString = JSON . stringify ( existingLaunchConfigs , null , ' ' ) ;
461+ const lastBracket = launchJson . lastIndexOf ( ']' ) ;
462+ const lastBracketInExistingConfig = existingLaunchConfigsString . lastIndexOf ( ']' ) ;
463+ const firstBracketInExistingConfig = existingLaunchConfigsString . indexOf ( '[' ) ;
464+
465+ if ( lastBracket !== - 1 && lastBracketInExistingConfig !== - 1 && firstBracketInExistingConfig !== - 1 ) {
466+ launchJson = launchJson . substring ( 0 , lastBracket ) ;
467+ existingLaunchConfigsString = existingLaunchConfigsString . substring ( firstBracketInExistingConfig + 1 , lastBracketInExistingConfig ) ;
468+ launchJson = `${ launchJson } ,${ existingLaunchConfigsString } ]` ;
469+ }
470+ }
447471
448472 const configurationsMassaged : string = indentJsonString ( launchJson ) ;
449-
450473 const launchJsonText = `
451474{
452475 // Use IntelliSense to find out which attributes exist for C# debugging
0 commit comments