@@ -37,11 +37,29 @@ export enum TaskConfigStatus {
37
37
detected = "Detected Task" // The tasks that are available based on detected compilers.
38
38
}
39
39
40
- const localizeConfigs = ( items : MenuItem [ ] ) : MenuItem [ ] => {
40
+ const addDetailToConfigs = ( items : MenuItem [ ] ) : MenuItem [ ] => {
41
41
items . map ( ( item : MenuItem ) => {
42
- item . detail = ( item . detail === TaskConfigStatus . recentlyUsed ) ? localize ( "recently.used.task" , "Recently Used Task" ) :
43
- ( item . detail === TaskConfigStatus . configured ) ? localize ( "configured.task" , "Configured Task" ) :
44
- ( item . detail === TaskConfigStatus . detected ) ? localize ( "detected.task" , "Detected Task" ) : item . detail ;
42
+ switch ( item . detail ) {
43
+ case TaskConfigStatus . recentlyUsed : {
44
+ item . detail = localize ( "recently.used.task" , "Recently Used Task" ) ;
45
+ break ;
46
+ }
47
+ case TaskConfigStatus . configured : {
48
+ item . detail = localize ( "configured.task" , "Configured Task" ) ;
49
+ break ;
50
+ }
51
+ case TaskConfigStatus . detected : {
52
+ item . detail = localize ( "detected.task" , "Detected Task" ) ;
53
+ break ;
54
+ }
55
+ default : {
56
+ break ;
57
+ }
58
+ }
59
+ if ( item . configuration . taskDetail ) {
60
+ // Add the compiler path of the preLaunchTask to the description of the debug configuration.
61
+ item . detail = ( item . detail ?? "" ) + " (" + item . configuration . taskDetail + ")" ;
62
+ }
45
63
46
64
} ) ;
47
65
return items ;
@@ -120,7 +138,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
120
138
return menuItem ;
121
139
} ) ;
122
140
123
- const selection : MenuItem | undefined = await vscode . window . showQuickPick ( localizeConfigs ( items ) , { placeHolder : localize ( "select.configuration" , "Select a configuration" ) } ) ;
141
+ const selection : MenuItem | undefined = await vscode . window . showQuickPick ( addDetailToConfigs ( items ) , { placeHolder : localize ( "select.configuration" , "Select a configuration" ) } ) ;
124
142
if ( ! selection ) {
125
143
Telemetry . logDebuggerEvent ( DebuggerEvent . debugPanel , { "debugType" : "debug" , "folderMode" : folder ? "folder" : "singleFile" , "cancelled" : "true" } ) ;
126
144
return [ ] ; // User canceled it.
@@ -343,6 +361,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
343
361
// Add the "detail" property to show the compiler path in QuickPickItem.
344
362
// This property will be removed before writing the DebugConfiguration in launch.json.
345
363
newConfig . detail = localize ( "pre.Launch.Task" , "preLaunchTask: {0}" , task . name ) ;
364
+ newConfig . taskDetail = task . detail ;
346
365
newConfig . existing = ( task . name === DebugConfigurationProvider . recentBuildTaskLabelStr ) ?
347
366
TaskConfigStatus . recentlyUsed :
348
367
( task . existing ? TaskConfigStatus . configured : TaskConfigStatus . detected ) ;
@@ -625,6 +644,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
625
644
config . detail = undefined ;
626
645
config . existing = undefined ;
627
646
config . isDefault = undefined ;
647
+ config . taskDetail = undefined ;
628
648
rawLaunchJson . configurations . push ( config ) ;
629
649
630
650
if ( ! launchJsonPath ) {
@@ -712,7 +732,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
712
732
sortedItems = sortedItems . concat ( items . filter ( item => item . detail === TaskConfigStatus . configured ) ) ;
713
733
sortedItems = sortedItems . concat ( items . filter ( item => item . detail === TaskConfigStatus . detected ) ) ;
714
734
715
- selection = await vscode . window . showQuickPick ( localizeConfigs ( sortedItems ) , {
735
+ selection = await vscode . window . showQuickPick ( addDetailToConfigs ( sortedItems ) , {
716
736
placeHolder : ( items . length === 0 ? localize ( "no.compiler.found" , "No compiler found" ) : localize ( "select.debug.configuration" , "Select a debug configuration" ) )
717
737
} ) ;
718
738
}
0 commit comments