Unwanted output in the terminal of VScode

Viewed 1500

I love visual studio code . But the main problem is when i run a program, i get some unwanted output in the terminal

I attached an image, where the unwanted output is wrapped in red line.Is there any way to get rid of this unwanted output in the terminal ? enter image description here

2 Answers

It worked for me:

  • Open Visual Studio Code and press F1 to open the command panel
  • Search for Preferences: Open User Settings (JSON) and open it. It will open a settings.json file
  • You may see something like this
{
    "editor.fontSize": 17,
    "code-runner.runInTerminal": true,
    "terminal.integrated.defaultProfile.windows": "PowerShell"
}
  • Paste the code below, above "terminal.integrated.defaultProfile.windows": "PowerShell"
"terminal.integrated.profiles.windows": 
{
    "PowerShell": 
    {
        "source": "PowerShell",
        "args": ["-noLogo"]
    }
},
  • After this, the settings.json should be something like this
{
    "editor.fontSize": 17,
    "code-runner.runInTerminal": true,
    "terminal.integrated.profiles.windows": 
    {
        "PowerShell": 
        {
            "source": "PowerShell",
            "args": ["-noLogo"]
        }
    },
    "terminal.integrated.defaultProfile.windows": "PowerShell"
}
  • Hit Ctrl+S to save and close settings.json

enter image description here

  1. Install code runner extension

  2. Go to Code Runner extensions settings

Search for Executor Map and then click Edit in settings.json Depending on the programing language that you use add the following instead of default one:

"c": "cls && function prompt{">>"} && $Host.ui.rawui.foregroundcolor = "cyan" && cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt && echo `n && $Host.ui.rawui.foregroundcolor = "red"",

In case you use C++ then just change "c": to "cpp": and be aware to to replace gcc to g++ or to clang++ in case you use clang

you can check my videos for detailed explanation

quick: https://youtu.be/yq8j3AsEOL0

Detailed: https://youtu.be/WM5iW8SyGpk

Related