Skip to content

Commit 7b7effb

Browse files
author
Elaheh Rashedi
authored
add compiler path to debug configs details (#9264)
1 parent 0d0b9ee commit 7b7effb

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

Extension/src/Debugger/configurationProvider.ts

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,29 @@ export enum TaskConfigStatus {
3737
detected = "Detected Task" // The tasks that are available based on detected compilers.
3838
}
3939

40-
const localizeConfigs = (items: MenuItem[]): MenuItem[] => {
40+
const addDetailToConfigs = (items: MenuItem[]): MenuItem[] => {
4141
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+
}
4563

4664
});
4765
return items;
@@ -120,7 +138,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
120138
return menuItem;
121139
});
122140

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")});
124142
if (!selection) {
125143
Telemetry.logDebuggerEvent(DebuggerEvent.debugPanel, { "debugType": "debug", "folderMode": folder ? "folder" : "singleFile", "cancelled": "true" });
126144
return []; // User canceled it.
@@ -343,6 +361,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
343361
// Add the "detail" property to show the compiler path in QuickPickItem.
344362
// This property will be removed before writing the DebugConfiguration in launch.json.
345363
newConfig.detail = localize("pre.Launch.Task", "preLaunchTask: {0}", task.name);
364+
newConfig.taskDetail = task.detail;
346365
newConfig.existing = (task.name === DebugConfigurationProvider.recentBuildTaskLabelStr) ?
347366
TaskConfigStatus.recentlyUsed :
348367
(task.existing ? TaskConfigStatus.configured : TaskConfigStatus.detected);
@@ -625,6 +644,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
625644
config.detail = undefined;
626645
config.existing = undefined;
627646
config.isDefault = undefined;
647+
config.taskDetail = undefined;
628648
rawLaunchJson.configurations.push(config);
629649

630650
if (!launchJsonPath) {
@@ -712,7 +732,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
712732
sortedItems = sortedItems.concat(items.filter(item => item.detail === TaskConfigStatus.configured));
713733
sortedItems = sortedItems.concat(items.filter(item => item.detail === TaskConfigStatus.detected));
714734

715-
selection = await vscode.window.showQuickPick(localizeConfigs(sortedItems), {
735+
selection = await vscode.window.showQuickPick(addDetailToConfigs(sortedItems), {
716736
placeHolder: (items.length === 0 ? localize("no.compiler.found", "No compiler found") : localize("select.debug.configuration", "Select a debug configuration"))
717737
});
718738
}

0 commit comments

Comments
 (0)