原因
runcode插件默认包含执行选中文本功能
当运行程序时会优先执行光标选中的代码并生成temp文件
解决方法
方法一:删除生成文件
在setting.json中添加
"code-runner.executorMap": {
"php": "php $fullFileName && $dvar=$dir && del $dvar\"tempCodeRunnerFile.php\"",
}
注意这里需要根据不同语言进行相应更改
如pyhton
"python": "python $fullFileName && $dvar=$dir && del $dvar\"tempCodeRunnerFile.py\""
详见:vscode的code runner不生成临时文件
方法二:取消执行选中代码功能
方法一
在setting.json中添加
"code-runner.ignoreSelection": true
方法二
在设置中搜索ignoreSelection并勾选Whether to ignore selection to always run entire file.
详见:https://github.com/formulahendry/vscode-code-runner/issues/305