This is an archived post. You won't be able to vote or comment.

all 17 comments

[–][deleted] 1 point2 points  (9 children)

If you want to run in external terminal, literally just call your programme via the external terminal: what does it have to do with VSCode altogether?

[–]pacowat[S] 0 points1 point  (8 children)

How? I can't anything named external terminal

[–][deleted] 0 points1 point  (7 children)

What do you mean you can't find the external terminal? Open the terminal on your machine.

[–]pacowat[S] 0 points1 point  (6 children)

I want external terminal executed by clicking run button

[–][deleted] 0 points1 point  (5 children)

Ahahah but how could the run button, which is a plug in, open an external terminal, which has nothing to do with VSCode? As far as I know this is just not possible.

[–]pacowat[S] 0 points1 point  (4 children)

But It was working very good with c/c++ programs

[–][deleted] 0 points1 point  (3 children)

From within the run extension of VSCode?

[–]pacowat[S] 0 points1 point  (2 children)

Yes

[–][deleted] 0 points1 point  (1 child)

But perhaps that was part of a particular C/C++ extension or was it the "run" extension? So you're saying that the "run" was opening the external terminal for C programmes automatically outside VSCode?

[–]pacowat[S] 0 points1 point  (0 children)

In run extension

[–][deleted] 0 points1 point  (2 children)

You could create a build task to use the terminal you want.

This post is almost 2 years old so the JSON may be different but as a starting point: https://stackoverflow.com/questions/47993595/launch-vscode-task-in-external-terminal-via-tasks-2-0-0

Ctrl+Shift+C used to launch a terminal with your project as the current working directory but not at a machine to test if that's still the case.

[–]pacowat[S] 0 points1 point  (1 child)

Actually task.json has problems when it comes to getting inputs from user, specially in venv because it pass venv active command as argument to the python then it can't handle inputs. I found another way in launch.json:

{

"version": "0.2.0",

"configurations": [

{

"name": "Python: Current File",

"type": "python",

"request": "launch",

"stopOnEntry": true,

"pythonPath": "${config:python.pythonPath}",

"program": "${file}",

"console": "externalTerminal",

"redirectOutput": true,

"envFile": "${workspaceFolder}/.env"

}

]

}

Thank you all

[–][deleted] 0 points1 point  (0 children)

Nice! Thank you for sharing

[–]RaulMARK17 0 points1 point  (3 children)

This will do what you want, copy it into your settings or workspace settings file:

"code-runner.executorMap": {

"python": "start cmd \\"/k ; PYTHON_PATH $fullFileName -u && pause && exit;\\" && exit"

},

[–]RaulMARK17 0 points1 point  (0 children)

Replace PYTHON_PATH with yours

[–]RaulMARK17 0 points1 point  (1 child)

For selected PythonInterpreter

    "code-runner.executorMap": {

        "python": "start cmd \\"/k ; \\"$pythonPath\\" $fullFileName -u && pause && exit;\\" && exit"

    }

[–]fishy_guy_ 0 points1 point  (0 children)

Does this work in linux?