Add VSCode Task Description (#19)

It's easy to use cargo play from VSCode using the task system. This diff adds a task description to be added for running CargoPlay.
This commit is contained in:
Mat Wood 2020-01-29 14:21:31 -08:00 committed by GitHub
parent 39e73a6d96
commit 0a51c96f5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 0 deletions

View file

@ -104,6 +104,37 @@ command! CargoPlay !cargo play %
With your code file open, running `:CargoPlay` will allow you to test your current file within an auto-generated cargo project.
### VSCode
Open Command Palette and select **Configure Task**
- *This will either create a new tasks.json or open your existing tasks.json*
Add the following task:
```json
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "CargoPlay",
"command": "cargo",
"args": [
"play",
"${file}",
],
"problemMatcher": [
"$rustc"
]
}
]
}
```
Now open the Command Palette, select **Run Task** and then run the new **CargoPlay** task
<img src="./recordings/vscode_run_task.png" width="600">
## Acknowledgements
This project is inspired by [play.rust-lang.org](https://play.rust-lang.org) and [RustPlayground](https://github.com/cmyr/RustPlayground).

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB