mirror of
https://github.com/fanzeyi/cargo-play
synced 2024-11-21 18:13:02 +00:00
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:
parent
39e73a6d96
commit
0a51c96f5b
2 changed files with 31 additions and 0 deletions
31
README.md
31
README.md
|
@ -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).
|
||||
|
|
BIN
recordings/vscode_run_task.png
Normal file
BIN
recordings/vscode_run_task.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
Loading…
Reference in a new issue