Skip to content

Commit 48eeea9

Browse files
committed
Bind commands for terminal.sendSequence and terminal.kill
Signed-off-by: Vladyslav Zhukovskyi <[email protected]>
1 parent 99a7aa3 commit 48eeea9

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

packages/plugin-ext-vscode/src/browser/plugin-vscode-commands-contribution.ts

+33
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ import { URI } from 'vscode-uri';
5454
import { MonacoEditor } from '@theia/monaco/lib/browser/monaco-editor';
5555
import { TerminalFrontendContribution } from '@theia/terminal/lib/browser/terminal-frontend-contribution';
5656
import { QuickOpenWorkspace } from '@theia/workspace/lib/browser/quick-open-workspace';
57+
import { TerminalService } from '@theia/terminal/lib/browser/base/terminal-service';
5758

5859
export namespace VscodeCommands {
5960
export const OPEN: Command = {
@@ -93,6 +94,8 @@ export class PluginVscodeCommandsContribution implements CommandContribution {
9394
protected readonly terminalContribution: TerminalFrontendContribution;
9495
@inject(QuickOpenWorkspace)
9596
protected readonly quickOpenWorkspace: QuickOpenWorkspace;
97+
@inject(TerminalService)
98+
protected readonly terminalService: TerminalService;
9699

97100
registerCommands(commands: CommandRegistry): void {
98101
commands.registerCommand(VscodeCommands.OPEN, {
@@ -584,5 +587,35 @@ export class PluginVscodeCommandsContribution implements CommandContribution {
584587
}, {
585588
execute: () => commands.executeCommand(WorkspaceCommands.NEW_FOLDER.id)
586589
});
590+
commands.registerCommand({
591+
id: 'workbench.action.terminal.sendSequence'
592+
}, {
593+
execute: (args?: { text?: string }) => {
594+
if (args === undefined || args.text === undefined) {
595+
return;
596+
}
597+
598+
const currentTerminal = this.terminalService.currentTerminal;
599+
600+
if (currentTerminal === undefined) {
601+
return;
602+
}
603+
604+
currentTerminal.sendText(args.text);
605+
}
606+
});
607+
commands.registerCommand({
608+
id: 'workbench.action.terminal.kill'
609+
}, {
610+
execute: () => {
611+
const currentTerminal = this.terminalService.currentTerminal;
612+
613+
if (currentTerminal === undefined) {
614+
return;
615+
}
616+
617+
currentTerminal.dispose();
618+
}
619+
});
587620
}
588621
}

0 commit comments

Comments
 (0)