4

How can I respond to my program in the Output tab of Visual Studio Code?

I am using the Code Runner extension. Here is a picture of what I want (lower part, near "Ausgabe"):

Down here in Ausgabe

4 Answers 4

3

The Output panel doesn't support input. That's one of the reasons why they switched from Output panel to Terminal in version 2 of the Tasks API.

It seems the Code Runner extension supports running in the Terminal as well:

"code-runner.runInTerminal": true
Sign up to request clarification or add additional context in comments.

Comments

1

In Visual Studio Code (for Mac OS) version 1.49.0, you can input data through the Output panel after you make the following change in settings:

  1. Click the gear icon in the bottom left corner and select Settings:

    see screenshot

  2. Enter "run in terminal" in the search bar:

    see screenshot

  3. Check the box next to "Whether to run code in Integrated Terminal".

Attention: Remember to uncheck the box if you want to display the code results on the Output tab again.

Comments

0

Yup! you cannot write in the output terminal.

But if you don't want to run that in integrated terminal you can just modify your code-runner.executorMap to run that code in a new terminal, which closes after your execution gets finished.

"code-runner.executorMap":{
      "c":   "cd $dir && gcc $fileName -o $fileNameWithoutExt && gnome-terminal -- bash -c \"./$fileNameWithoutExt\"",  
      "cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && gnome-terminal -- bash -c \"./$fileNameWithoutExt\"",  
}

this is for C & C++ and similarly you can write it for other languages as well.

here i have added the gnome-terminal -- bash -c \"./$fileNameWithoutExt\" part

for details of this command, Click here! .

1 Comment

-x was getting deprecated and might get removed in a later version of gnome-terminal, hence I used --
0

There is no way to give input in the output section, as you already know, output means result. But there is a workaround for it.

  • Step 1: Open settings for you VS_Studio
  • Step 2: Type (code runner) in the search bar
  • Step 3: Look for "Whether to run in Integrated Terminal"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.