Reputation: 880
I wonder if it's possible to have some sort of a run configuration in VSCode that will open 2 terminal tabs (preferably by splitting 1 window into 2 terminal tabs vertically) and run 2 separate commands in them.
Use case: I have a repository with backend and frontend. When I have to develop this application, I need to execute:
cd ./backend
poetry run dev
# in 2nd tab
cd ./frontend
npm run dev
Every time I split terminal manually and manually run these commands. Is it possible to automate it? So I can click 1 button or something?
Thanks
Upvotes: 2
Views: 62
Reputation: 880
Seems like I've figured it out. My tasks.json
:
{
"version": "2.0.0",
"tasks": [
{
"label": "Run application",
"dependsOn": ["Frontend", "Backend"],
"group": {
"kind": "build",
"isDefault": true
},
},
{
"label": "Frontend",
"type": "shell",
"command": "cd frontend && npm run dev",
"presentation": {
"reveal": "always",
"group": "development"
},
},
{
"label": "Backend",
"type": "shell",
"command": "cd backend && poetry run dev",
"presentation": {
"reveal": "always",
"group": "development"
}
}
]
}
Now I can run Run application
task and it will do what I described.
The trick was to use presentation.group
field
Upvotes: 1