如何在VScode上调试时添加用户输入?
我试过以下几种方法
externalConsole : true不管接下来的步骤如何,上面的方法都是错误的。
我一直在找一扇我什么也做不了的窗户。上/下/入按钮不起作用。
在我的launch.json文件中
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "g++-10 - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "lldb",
"preLaunchTask": "C/C++: g++-10 build active file"
}
]
} 这是我的tasks.json文件
{
"tasks": [
{
"type": "shell",
"label": "C/C++: g++-10 build active file",
"command": "g++",
"args": [
"-g",
"${file}",
"-std=c++17",
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
],
"version": "2.0.0"
}系统细节
Version: 1.48.1
Commit: 3dd905126b34dcd4de81fa624eb3a8cbe7485f13
Date: 2020-08-19T17:09:41.484Z
Electron: 7.3.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 20.0.0发布于 2020-08-25 09:53:35
该决议是在gist 这里中给出的。
问题是当VSCode启动调试适配器时,调试适配器启动lldb-mi,然后lldb-mi启动终端。应该出现一个提示符,但不知何故,DebugAdapter没有转发此权限请求。工作是让VS代码启动终端一次。您可以通过在
tasks.json中添加和运行此任务来完成此任务:
{
"label": "Open Terminal",
"type": "shell",
"command": "osascript -e 'tell application \"Terminal\"\ndo script \"echo hello\"\nend tell'",
"problemMatcher": []
}您可以使用Command + Shift + p. Tasks运行此特定任务,然后查找任务:运行任务,然后选择“开放终端”。
我写了一个关于同样的小博客文章,详细介绍了每一步的图片,可以找到这里。
https://stackoverflow.com/questions/63576309
复制相似问题