我试图在vscode中启动客户端和服务器。这两项任务都可以自行完成。但是,我无法在工作区配置中运行复合任务。
我的假设是工作区配置中的任务应该出现在调试下拉启动菜单中,根据文档 - https://code.visualstudio.com/docs/editor/multi-root-workspaces#_debugging
这只是vscode的一个错误,还是我的配置有问题?所有3个配置文件都在下面。
客户端launch.json
}
"version": "2.0.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Start Client",
"program": "${workspaceFolder}/src/index.ts",
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"console": "integratedTerminal"
}
]
}
服务器launch.json
}
"version": "2.0.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Start Server",
"program": "${workspaceFolder}/src/index.ts",
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
}
]
}
工作区配置
{
"folders": [
{
"path": "client"
},
{
"path": "server"
}
],
"launch": {
"compounds": [
{
"name": "Server & Client",
"configurations": [
"Start Client",
"Start Server"
]
}
]
}
}
几个小时后才找到答案。
"launch": {
"configurations": [], // This line was needed
"compounds": [
{
"name": "Server & Client",
"configurations": [
"Start Client",
"Start Server"
]
}
]
}