Skip to content

Commit

Permalink
Merge pull request #180467 from microsoft/merogge/sendText
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge committed Apr 21, 2023
2 parents 23ee753 + 7a11584 commit b19017c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/vs/workbench/contrib/terminal/browser/terminalActions.ts
Expand Up @@ -502,7 +502,7 @@ export function registerTerminalActions() {
title: { value: localize('workbench.action.terminal.runSelectedText', "Run Selected Text In Active Terminal"), original: 'Run Selected Text In Active Terminal' },
run: async (c, accessor) => {
const codeEditorService = accessor.get(ICodeEditorService);
const instance = await c.service.getActiveOrCreateInstance();
let instance = await c.service.getActiveOrCreateInstance();
const editor = codeEditorService.getActiveCodeEditor();
if (!editor || !editor.hasModel()) {
return;
Expand All @@ -515,6 +515,12 @@ export function registerTerminalActions() {
const endOfLinePreference = isWindows ? EndOfLinePreference.LF : EndOfLinePreference.CRLF;
text = editor.getModel().getValueInRange(selection, endOfLinePreference);
}
// Don't use task terminals or other terminals that don't accept input
if (instance?.xterm?.isStdinDisabled || instance?.shellLaunchConfig.type === 'Task') {
instance = await c.service.createTerminal();
c.service.setActiveInstance(instance);
await revealActiveTerminal(instance, c);
}
instance.sendText(text, true, true);
await revealActiveTerminal(instance, c);
}
Expand Down

0 comments on commit b19017c

Please sign in to comment.