@@ -262,10 +262,11 @@ export class RunInTerminalTool extends Disposable implements IToolImpl {
262
262
break ;
263
263
}
264
264
case 'subCommand' : {
265
- if ( subCommandResults . length === 1 ) {
266
- autoApproveInfo = new MarkdownString ( `_${ localize ( 'autoApprove.rule' , 'Auto approved by rule {0}' , subCommandResults . map ( e => `[\`${ e . rule ! . sourceText } \`](settings_${ e . rule ! . sourceTarget } )` ) . join ( ', ' ) ) } _` ) ;
267
- } else if ( subCommandResults . length > 1 ) {
268
- autoApproveInfo = new MarkdownString ( `_${ localize ( 'autoApprove.rules' , 'Auto approved by rules {0}' , subCommandResults . map ( e => `[\`${ e . rule ! . sourceText } \`](settings_${ e . rule ! . sourceTarget } )` ) . join ( ', ' ) ) } _` ) ;
265
+ const uniqueRules = Array . from ( new Set ( subCommandResults . map ( e => `[\`${ e . rule ! . sourceText } \`](settings_${ e . rule ! . sourceTarget } )` ) ) ) ;
266
+ if ( uniqueRules . length === 1 ) {
267
+ autoApproveInfo = new MarkdownString ( `_${ localize ( 'autoApprove.rule' , 'Auto approved by rule {0}' , uniqueRules [ 0 ] ) } _` ) ;
268
+ } else if ( uniqueRules . length > 1 ) {
269
+ autoApproveInfo = new MarkdownString ( `_${ localize ( 'autoApprove.rules' , 'Auto approved by rules {0}' , uniqueRules . join ( ', ' ) ) } _` ) ;
269
270
}
270
271
break ;
271
272
}
@@ -280,10 +281,11 @@ export class RunInTerminalTool extends Disposable implements IToolImpl {
280
281
}
281
282
case 'subCommand' : {
282
283
const deniedRules = subCommandResults . filter ( e => e . result === 'denied' ) ;
283
- if ( deniedRules . length === 1 ) {
284
- autoApproveInfo = new MarkdownString ( `_${ localize ( 'autoApproveDenied.rule' , 'Auto approval denied by rule {0}' , deniedRules . map ( e => `[\`${ e . rule ! . sourceText } \`](settings_${ e . rule ! . sourceTarget } )` ) . join ( ', ' ) ) } _` ) ;
285
- } else if ( deniedRules . length > 1 ) {
286
- autoApproveInfo = new MarkdownString ( `_${ localize ( 'autoApproveDenied.rules' , 'Auto approval denied by rules {0}' , deniedRules . map ( e => `[\`${ e . rule ! . sourceText } \`](settings_${ e . rule ! . sourceTarget } )` ) . join ( ', ' ) ) } _` ) ;
284
+ const uniqueRules = Array . from ( new Set ( deniedRules . map ( e => `[\`${ e . rule ! . sourceText } \`](settings_${ e . rule ! . sourceTarget } )` ) ) ) ;
285
+ if ( uniqueRules . length === 1 ) {
286
+ autoApproveInfo = new MarkdownString ( `_${ localize ( 'autoApproveDenied.rule' , 'Auto approval denied by rule {0}' , uniqueRules [ 0 ] ) } _` ) ;
287
+ } else if ( uniqueRules . length > 1 ) {
288
+ autoApproveInfo = new MarkdownString ( `_${ localize ( 'autoApproveDenied.rules' , 'Auto approval denied by rules {0}' , uniqueRules . join ( ', ' ) ) } _` ) ;
287
289
}
288
290
break ;
289
291
}
@@ -879,7 +881,7 @@ export class RunInTerminalTool extends Disposable implements IToolImpl {
879
881
const canCreateAutoApproval = autoApproveResult . subCommandResults . some ( e => e . result !== 'denied' ) || autoApproveResult . commandLineResult . result === 'denied' ;
880
882
if ( canCreateAutoApproval ) {
881
883
// Allow all sub-commands
882
- const subCommandsFirstWordOnly = subCommands . map ( command => command . split ( ' ' ) [ 0 ] ) ;
884
+ const subCommandsFirstWordOnly = Array . from ( new Set ( subCommands . map ( command => command . split ( ' ' ) [ 0 ] ) ) ) ;
883
885
let subCommandLabel : string ;
884
886
let subCommandTooltip : string ;
885
887
if ( subCommandsFirstWordOnly . length === 1 ) {
0 commit comments