Ответ 1
Вы можете определить задачу в вашем файле tasks.json
и указать ее как preLaunchTask
в launch.json
и задача будет выполнена до начала отладки.
Пример:
В tasks.json:
Для версии 0.1.0:
{
"version": "0.1.0",
"tasks": [{
"taskName": "echotest",
"command": "echo", // Could be any other shell command
"args": ["test"],
"isShellCommand": true
}]
}
Для версии 2.0.0 (новее и рекомендуется):
{
"version": "2.0.0",
"tasks": [{
"label": "echotest",
"command": "echo", // Could be any other shell command
"args": ["test"],
"type": "shell"
}]
}
В launch.json:
{
"configurations": [
{
// ...
"preLaunchTask": "echotest", // The name of the task defined above
// ...
}
]
}
Документация по задачам: https://code.visualstudio.com/docs/editor/tasks
Запустите конфигурацию: https://code.visualstudio.com/docs/editor/debugging#_launch-configurations