Run command in vscode

I need a run command in VSCode. It seems you can hack some stuff together, but I don't want it to simply run.

I need it to run my current app (i.e. cargo run) but if there's already a version running, it would need to kill the running process and then compile and run it again.

I'm not sure how others do it but without hot reload I don't see how you can develop quickly without this built-in.

Most people use cargo watch to automatically re-compile their crates and restart the server whenever there are any changes.

For a specific example, this is what I have running in my terminal whenever I'm doing stuff for work:

cargo watch --clear \
    -x "check --workspace" \
    -x "test --workspace" \
    -x "doc --document-private-items --workspace" \
    -x "build --release --workspace" \
    -x "clippy --workspace"
1 Like

Is the --workspace really necessary?

All the projects I work on are workspaces, so I need it.

Wow. This really saved my life!

Having to wait seconds after each Askama change before the entire thing compiles is still painful, but now I at least don't have to manually rebuild the project.