@@ -24,11 +24,9 @@ import { IExtensionTerminalQuickFix } from 'vs/platform/terminal/common/terminal
24
24
import { URI } from 'vs/base/common/uri' ;
25
25
import { gitCreatePr , gitPushSetUpstream , gitSimilar } from 'vs/workbench/contrib/terminal/browser/terminalQuickFixBuiltinActions' ;
26
26
import { AudioCue , IAudioCueService } from 'vs/platform/audioCues/browser/audioCueService' ;
27
- import { ICommandService } from 'vs/platform/commands/common/commands' ;
28
27
import { IActionWidgetService } from 'vs/platform/actionWidget/browser/actionWidget' ;
29
28
import { ActionSet } from 'vs/platform/actionWidget/common/actionWidget' ;
30
- import { TerminalQuickFix , toMenuItems } from 'vs/workbench/contrib/terminal/browser/widgets/terminalQuickFixMenuItems' ;
31
- import { previewSelectedActionCommand } from 'vs/platform/actionWidget/browser/actionList' ;
29
+ import { TerminalQuickFix , TerminalQuickFixType , toMenuItems } from 'vs/workbench/contrib/terminal/browser/widgets/terminalQuickFixMenuItems' ;
32
30
33
31
const quickFixTelemetryTitle = 'terminal/quick-fix' ;
34
32
type QuickFixResultTelemetryEvent = {
@@ -80,7 +78,6 @@ export class TerminalQuickFixAddon extends Disposable implements ITerminalAddon,
80
78
@IOpenerService private readonly _openerService : IOpenerService ,
81
79
@ITelemetryService private readonly _telemetryService : ITelemetryService ,
82
80
@ILogService private readonly _logService : ILogService ,
83
- @ICommandService private readonly _commandService : ICommandService ,
84
81
@IActionWidgetService private readonly _actionWidgetService : IActionWidgetService
85
82
) {
86
83
super ( ) ;
@@ -233,7 +230,7 @@ export class TerminalQuickFixAddon extends Disposable implements ITerminalAddon,
233
230
} ;
234
231
// TODO: What's documentation do? Need a vscode command?
235
232
const documentation = fixes . map ( f => { return { id : f . id , title : f . label , tooltip : f . tooltip } ; } ) ;
236
- const actions = fixes . map ( f => new TerminalQuickFix ( f , f . label ) ) ;
233
+ const actions = fixes . map ( f => new TerminalQuickFix ( f , f . class || TerminalQuickFixType . Command , f . label ) ) ;
237
234
const actionSet = {
238
235
// TODO: Documentation and actions are separate?
239
236
documentation,
@@ -248,13 +245,9 @@ export class TerminalQuickFixAddon extends Disposable implements ITerminalAddon,
248
245
return ;
249
246
}
250
247
const delegate = {
251
- onSelect : async ( fix : TerminalQuickFix , preview ?: boolean ) => {
252
- if ( preview ) {
253
- this . _commandService . executeCommand ( previewSelectedActionCommand ) ;
254
- } else {
255
- fix . action ?. run ( ) ;
256
- this . _actionWidgetService . hide ( ) ;
257
- }
248
+ onSelect : async ( fix : TerminalQuickFix ) => {
249
+ fix . action ?. run ( ) ;
250
+ this . _actionWidgetService . hide ( ) ;
258
251
} ,
259
252
onHide : ( ) => {
260
253
this . _terminal ?. focus ( ) ;
@@ -303,12 +296,12 @@ export function getQuickFixesForCommand(
303
296
let action : IAction | undefined ;
304
297
if ( 'type' in quickFix ) {
305
298
switch ( quickFix . type ) {
306
- case 'command' : {
299
+ case TerminalQuickFixType . Command : {
307
300
const label = localize ( 'quickFix.command' , 'Run: {0}' , quickFix . command ) ;
308
301
action = {
309
302
id : quickFix . id ,
310
303
label,
311
- class : undefined ,
304
+ class : quickFix . type ,
312
305
enabled : true ,
313
306
run : ( ) => {
314
307
onDidRequestRerunCommand ?. fire ( {
@@ -322,12 +315,12 @@ export function getQuickFixesForCommand(
322
315
expectedCommands . push ( quickFix . command ) ;
323
316
break ;
324
317
}
325
- case 'opener' : {
318
+ case TerminalQuickFixType . Opener : {
326
319
const label = localize ( 'quickFix.opener' , 'Open: {0}' , quickFix . uri . toString ( ) ) ;
327
320
action = {
328
- id : ` quickFix.opener` ,
321
+ id : quickFix . id ,
329
322
label,
330
- class : undefined ,
323
+ class : quickFix . type ,
331
324
enabled : true ,
332
325
run : ( ) => {
333
326
openerService . open ( quickFix . uri ) ;
@@ -418,7 +411,7 @@ export function convertToQuickFixOptions(quickFix: IExtensionTerminalQuickFix):
418
411
}
419
412
link = link . replaceAll ( varToResolve , value ) ;
420
413
}
421
- return link ? { type : 'opener' , uri : URI . parse ( link ) } as ITerminalQuickFixOpenerAction : [ ] ;
414
+ return link ? { type : 'opener' , uri : URI . parse ( link ) , id : quickFix . id } as ITerminalQuickFixOpenerAction : [ ] ;
422
415
} ,
423
416
exitStatus : quickFix . exitStatus ,
424
417
source : quickFix . extensionIdentifier
0 commit comments