按 F5 后,我意外地在 VS Code 中的某些功能上选择了“不要再问我”。现在,每次我按 F5 时,它都会在tasks.json 中添加默认任务,即使我还有其他两个任务也是如此。如何让它停止执行此操作或在按 F5 时询问我要运行哪个构建任务?这是之前和之后的tasks.json。
之前:
{
"tasks": [
{
"label": "C/C++: g++-13: Debug, x64",
"group": "build",
"detail": "g++ build: Debug x64",
"type": "cppbuild",
"command": "/usr/bin/g++-13",
"args": [
"-fdiagnostics-color=always",
"-g",
"-O0",
"-m64",
"${workspaceFolder}/${workspaceFolderBasename}/main.cpp",
"-o",
"${workspaceFolder}/build/${workspaceFolderBasename}.out",
"-I${workspaceFolder}/dependencies/MAVSDK/include/mavsdk",
"-L${workspaceFolder}/dependencies/MAVSDK/lib"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "C/C++: g++-13: Release, x64",
"group": "build",
"detail": "g++ build: Release x64",
"type": "cppbuild",
"command": "/usr/bin/g++-13",
"args": [
"-fdiagnostics-color=always",
"-g",
"-O3",
"-m64",
"${workspaceFolder}/${workspaceFolderBasename}/main.cpp",
"-o",
"${workspaceFolder}/build/${workspaceFolderBasename}.out",
"-I${workspaceFolder}/dependencies/MAVSDK/include/mavsdk",
"-L${workspaceFolder}/dependencies/MAVSDK/lib"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
]
}
],
"version": "2.0.0"
}
之后:
{
"tasks": [
{
"label": "C/C++: g++-13: Debug, x64",
"group": "build",
"detail": "g++ build: Debug x64",
"type": "cppbuild",
"command": "/usr/bin/g++-13",
"args": [
"-fdiagnostics-color=always",
"-g",
"-O0",
"-m64",
"${workspaceFolder}/${workspaceFolderBasename}/main.cpp",
"-o",
"${workspaceFolder}/build/${workspaceFolderBasename}.out",
"-I${workspaceFolder}/dependencies/MAVSDK/include/mavsdk",
"-L${workspaceFolder}/dependencies/MAVSDK/lib"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "C/C++: g++-13: Release, x64",
"group": "build",
"detail": "g++ build: Release x64",
"type": "cppbuild",
"command": "/usr/bin/g++-13",
"args": [
"-fdiagnostics-color=always",
"-g",
"-O3",
"-m64",
"${workspaceFolder}/${workspaceFolderBasename}/main.cpp",
"-o",
"${workspaceFolder}/build/${workspaceFolderBasename}.out",
"-I${workspaceFolder}/dependencies/MAVSDK/include/mavsdk",
"-L${workspaceFolder}/dependencies/MAVSDK/lib"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
]
},
{
"type": "cppbuild",
"label": "C/C++: g++-13 build active file",
"command": "/usr/bin/g++-13",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
删除“isDefault”:true行或将其设置为“false”,或者如果不再需要则删除整个任务。