Venyl
Venyl

Reputation: 39

How to hide the file path displaying in Visual Studio Code's terminal

After I run my python code in the terminal, it displays a few paths in the 1st line and then the output of my code in the 2nd line. Can I hide the 1st line so I only see the output in the 2nd line?

C:\Users\Venyl\Desktop\VS CODE\Code 2020>C:/Users/Venyl/AppData/Local/Programs/Python/Python38-32/python.exe "c:/Users/Venyl/Desktop/VS CODE/Code 2020/print('lol').py"
hello world

Upvotes: 3

Views: 33508

Answers (4)

Akash Wadode
Akash Wadode

Reputation: 1

Donwload code-runner extension in VsCode, then unchecked Code-runner:Show Execution Message in setting of code-runner extension. enter image description here

Upvotes: -2

shaderone
shaderone

Reputation: 498

If you use code-runner extension,

open settings.json (ctrl + shift + p then type settings.json) then add this

"code-runner.executorMap": {
    "python": "<console clear> && <python or your python version> -u",
},
"code-runner.clearPreviousOutput": true,
"code-runner.showExecutionMessage": false,
"code-runner.runInTerminal": true,

In my case i replaced

<console clear> with clear (since i am on wsl)

&&

<python or your python version> with python3.10

Upvotes: 1

Rohit Survase
Rohit Survase

Reputation: 71

The above answer works for displaying the output as desired however if you want to hide the long path

use prompt [text]

For example, the following command sets "> (greater-than sign)" as prompt

prompt $g

if you want to return back to showing full path just type prompt and press Enter.

Upvotes: 0

Jill Cheng
Jill Cheng

Reputation: 10354

  1. You could use the following settings in launch.json in the .vscode folder, and "console": sets the way the code debugging results are displayed.

"console": "internalConsole",

After setting it, the debugging result will be displayed in the "debug console" inside VSCode.

enter image description here

  1. We could also set it as:

"console": "externalTerminal",

and the debugging results will be displayed in the "cmd" window outside VSCode. It also only displays the debugging results:

enter image description here

  1. VSCode uses by default: "console": "integratedTerminal", it displays the results in the VSCode internal terminal, and displays the current environment and the path of the running file.

Reference: console.

Upvotes: 3

Related Questions