Add copy command to command decoration menu

Fixes #153382
This commit is contained in:
Daniel Imms 2022-07-06 10:41:54 -07:00
parent 04d9921d07
commit 891fa89364
No known key found for this signature in database
GPG key ID: E5CF412B63651C69

View file

@ -354,11 +354,16 @@ export class DecorationAddon extends Disposable implements ITerminalAddon {
private async _getCommandActions(command: ITerminalCommand): Promise<IAction[]> {
const actions: IAction[] = [];
if (command.command !== '') {
const label = localize("terminal.rerunCommand", 'Rerun Command');
const labelRun = localize("terminal.rerunCommand", 'Rerun Command');
actions.push({
class: undefined, tooltip: label, dispose: () => { }, id: 'terminal.rerunCommand', label, enabled: true,
class: undefined, tooltip: labelRun, dispose: () => { }, id: 'terminal.rerunCommand', label: labelRun, enabled: true,
run: () => this._onDidRequestRunCommand.fire({ command })
});
const labelCopy = localize("terminal.copyCommand", 'Copy Command');
actions.push({
class: undefined, tooltip: labelCopy, dispose: () => { }, id: 'terminal.copyCommand', label: labelCopy, enabled: true,
run: () => this._clipboardService.writeText(command.command)
});
}
if (command.hasOutput) {
if (actions.length > 0) {