为什么我执行Python时Code Runner总是在VSCode打开其他终端?以及如何解决?

Why Code Runner always open other terminal in VSCode when I execute Python? And how to fix it?

即使已经打开了一个终端,当我使用 运行 Python 代码使用 Code Runner (ctrl + alt + n) 时,它总是在 VSCode 中打开另一个终端。关闭旧的也没用,因为它又打开了。

这是我的终端配置,Python 和 Code Runner:

航站楼:

"terminal.integrated.copyOnSelection": true,
"terminal.integrated.cursorBlinking": true,
"terminal.integrated.cursorStyle": "line",
"terminal.integrated.defaultProfile.windows": "Command Prompt",
"terminal.integrated.letterSpacing": 1,

代码运行器:

"code-runner.clearPreviousOutput": true,
"code-runner.saveAllFilesBeforeRun": true,
"code-runner.ignoreSelection": true,
"code-runner.runInTerminal": true, //only 2 Python
"code-runner.executorMap": {
    "javascript": "node",

    "python": "venv\Scripts\python.exe -u", //code-runner exec python of venv
    "bat": "cmd /c"
},

Python:

"files.autoSave": "afterDelay",
"files.autoSaveDelay": 500,

"[python]": {
    "editor.defaultFormatter": "ms-python.python",
    "editor.insertSpaces": true
},

"python.pythonPath": "venv\Scripts\python.exe",
"python.analysis.completeFunctionParens": true,
"python.linting.flake8Enabled": true,
"python.linting.pycodestyleEnabled": true,
"python.linting.pycodestylePath": "[MyPathHere]",
"python.linting.flake8Path": "[MyPathHere]",
"python.formatting.provider": "black"

如何解决这个奇怪的行为?

感谢

这是代码运行器清除先前输出的问题,将其设置为 false 并手动将清除命令添加到其执行程序映射,最终结果应如下所示。所有这些都将在项目的 settings.json 文件中完成,位于 .vscode 文件夹下。

{
    "code-runner.runInTerminal": true,
    "code-runner.clearPreviousOutput": false,
    "code-runner.executorMap": {
        "c": "clear; cd $dir && gcc $fileName -o $fileNameWithoutExt && 
                   $dir$fileNameWithoutExt",
        "cpp": "clear; cd $dir && g++ $fileName -o $fileNameWithoutExt && 
                   $dir$fileNameWithoutExt",
    }
}