Skip to content

Commit

Permalink
Use notification prompt before running a command (#23035)
Browse files Browse the repository at this point in the history
* Use notification prompt before running a command

https://github.com/microsoft/vscode/pull/179702/commits

* Removes unused declarations
  • Loading branch information
lewis-sanchez committed May 8, 2023
1 parent a97d882 commit 3477a4f
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 @@ -27,6 +27,7 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
import { IGenericMarkProperties } from 'vs/platform/terminal/common/terminalProcess';
import { IQuickInputService, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
import { Codicon } from 'vs/base/common/codicons';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';

const enum DecorationSelector {
CommandDecoration = 'terminal-command-decoration',
Expand Down Expand Up @@ -68,7 +69,8 @@ export class DecorationAddon extends Disposable implements ITerminalAddon {
@IConfigurationService private readonly _configurationService: IConfigurationService,
@IThemeService private readonly _themeService: IThemeService,
@IOpenerService private readonly _openerService: IOpenerService,
@IQuickInputService private readonly _quickInputService: IQuickInputService
@IQuickInputService private readonly _quickInputService: IQuickInputService,
@INotificationService private readonly _notificationService: INotificationService
) {
super();
this._register(toDisposable(() => this._dispose()));
Expand Down Expand Up @@ -408,7 +410,15 @@ export class DecorationAddon extends Disposable implements ITerminalAddon {
const labelRun = localize("terminal.rerunCommand", 'Rerun Command');
actions.push({
class: undefined, tooltip: labelRun, dispose: () => { }, 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 3477a4f

Please sign in to comment.