@@ -88,6 +88,7 @@ export const CMD_GET_PROJECT_FILE = 'ada.getProjectFile';
8888export const CMD_SPARK_LIMIT_SUBP_ARG = 'ada.spark.limitSubpArg' ;
8989export const CMD_SPARK_LIMIT_REGION_ARG = 'ada.spark.limitRegionArg' ;
9090export const CMD_SPARK_PROVE_SUBP = 'ada.spark.proveSubprogram' ;
91+ const CMD_SPARK_ASK_OPTIONS = 'ada.spark.askSPARKOptions' ;
9192
9293/**
9394 * Identifier for the command that shows the extension's output in the Output panel.
@@ -247,6 +248,8 @@ export function registerCommands(context: vscode.ExtensionContext, clients: Exte
247248 vscode . commands . registerCommand ( CMD_SPARK_PROVE_SUBP , sparkProveSubprogram ) ,
248249 ) ;
249250
251+ context . subscriptions . push ( commands . registerCommand ( CMD_SPARK_ASK_OPTIONS , askSPARKOptions ) ) ;
252+
250253 context . subscriptions . push (
251254 commands . registerCommand ( 'ada.loadGnatCovXMLReport' , loadGnatCovXMLReport ) ,
252255 ) ;
@@ -1052,15 +1055,11 @@ async function sparkProveSubprogram(
10521055 uri : vscode . Uri ,
10531056 range : vscode . Range ,
10541057) : Promise < vscode . TaskExecution > {
1055- const [ tasks , cliArgs ] = await Promise . all ( [
1056- vscode . tasks . fetchTasks ( { type : TASK_TYPE_SPARK } ) ,
1057- askSPARKOptions ( ) ,
1058- ] ) ;
1059-
10601058 /**
10611059 * Get the 'Prove subprogram' task. Prioritize workspace tasks so that User
10621060 * customization of the task takes precedence.
10631061 */
1062+ const tasks = await vscode . tasks . fetchTasks ( { type : TASK_TYPE_SPARK } ) ;
10641063 const task = tasks
10651064 . sort ( workspaceTasksFirst )
10661065 . find (
@@ -1094,7 +1093,7 @@ async function sparkProveSubprogram(
10941093 */
10951094 const taskDef = newTask . definition as SimpleTaskDef ;
10961095 assert ( taskDef . args ) ;
1097- const regionArg = ' ${command:ada.spark.limitSubpArg}' ;
1096+ const regionArg = `\ ${command:${ CMD_SPARK_LIMIT_SUBP_ARG } }` ;
10981097 const regionArgIdx = taskDef . args . findIndex ( ( arg ) => arg == regionArg ) ;
10991098 if ( regionArgIdx >= 0 ) {
11001099 const fileBasename = basename ( uri . fsPath ) ;
@@ -1106,9 +1105,15 @@ async function sparkProveSubprogram(
11061105 newTask . name = `${ task . name } - ${ fileBasename } :${ range . start . line + 1 } ` ;
11071106
11081107 /**
1109- * Add the options chosen by the User
1108+ * Add a command to ask the User for options. We do this instead of
1109+ * pre-evaluating the options so that all invocations on the same
1110+ * subprogram have the same set of (unevaluated) arguments, which means
1111+ * that only one task shows up in the task history for each subprogram.
1112+ * If we pre-evaluated the options, then each different set of User
1113+ * choices would yield a different entry in the task history which is
1114+ * noisy.
11101115 */
1111- taskDef . args . splice ( regionArgIdx + 1 , 0 , ... cliArgs ) ;
1116+ taskDef . args . splice ( regionArgIdx + 1 , 0 , `\${command: ${ CMD_SPARK_ASK_OPTIONS } }` ) ;
11121117 } else {
11131118 throw Error (
11141119 `Task '${ getConventionalTaskLabel ( task ) } ' is missing a '${ regionArg } ' argument` ,
0 commit comments