Skip to content

Commit

Permalink
Merge pull request #179702 from microsoft/merogge/msrc
Browse files Browse the repository at this point in the history
Use notification prompt before running a command
  • Loading branch information
meganrogge authored Apr 11, 2023
2 parents 256e9db + c5489d8 commit 6740c2e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { TERMINAL_COMMAND_DECORATION_DEFAULT_BACKGROUND_COLOR, TERMINAL_COMMAND_
import { ILifecycleService } from 'vs/workbench/services/lifecycle/common/lifecycle';
import { IDecoration, ITerminalAddon, Terminal } from 'xterm';
import { AudioCue, IAudioCueService } from 'vs/platform/audioCues/browser/audioCueService';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';

interface IDisposableDecoration { decoration: IDecoration; disposables: IDisposable[]; exitCode?: number; markProperties?: IMarkProperties }

Expand All @@ -52,7 +53,8 @@ export class DecorationAddon extends Disposable implements ITerminalAddon {
@ILifecycleService lifecycleService: ILifecycleService,
@ICommandService private readonly _commandService: ICommandService,
@IInstantiationService instantiationService: IInstantiationService,
@IAudioCueService private readonly _audioCueService: IAudioCueService
@IAudioCueService private readonly _audioCueService: IAudioCueService,
@INotificationService private readonly _notificationService: INotificationService
) {
super();
this._register(toDisposable(() => this._dispose()));
Expand Down Expand Up @@ -349,7 +351,15 @@ export class DecorationAddon extends Disposable implements ITerminalAddon {
const labelRun = localize("terminal.rerunCommand", 'Rerun Command');
actions.push({
class: undefined, tooltip: labelRun, id: 'terminal.rerunCommand', label: labelRun, enabled: true,
run: () => this._onDidRequestRunCommand.fire({ command })
run: async () => {
this._notificationService.prompt(Severity.Info, localize('rerun', 'Do you want to run the command: {0}', command.command), [{
label: localize('yes', 'Yes'),
run: () => this._onDidRequestRunCommand.fire({ command })
}, {
label: localize('no', 'No'),
run: () => { }
}]);
}
});
const labelCopy = localize("terminal.copyCommand", 'Copy Command');
actions.push({
Expand Down

0 comments on commit 6740c2e

Please sign in to comment.