Configuration
![](https://thad.getterman.org/wp-content/uploads/2021/04/docker_desktop-1024x626.png)
Launch Docker Desktop and close/hide the window.
(Docker needs to run in the background for VSCode to use for devcontainers.)
![](https://thad.getterman.org/wp-content/uploads/2021/04/vsc_main-1024x594.png)
Launch Visual Studio Code.
![](https://thad.getterman.org/wp-content/uploads/2021/04/vsc_remote_containers-1024x594.png)
- At the bottom left corner of the window, you’ll see a green button with two arrows pointing to each other.
- A menu will then appear at the top, select “Remote-Containers: Open Folder in Container“.
- From there, open the
hello-world
directory that you created with cargo.
![](https://thad.getterman.org/wp-content/uploads/2021/04/macos_git_requires_cli_dev_tools-1024x549.png)
You may be prompted to install additional software.
![](https://thad.getterman.org/wp-content/uploads/2021/04/vscode_open_folder_container_config_prompt-1024x594.png)
VSCode will prompt you to choose the type of Development Environment, click on (or search for) Rust.
![](https://thad.getterman.org/wp-content/uploads/2021/04/vscode_opening_remote_rust_container-1024x594.png)
The development container’s Docker image will now be built for you.
![](https://thad.getterman.org/wp-content/uploads/2021/04/vscode_project_install_recommended_extensions.png)
In the bottom right corner, you will be asked if you would like to install recommended extensions into your project.
Click on the Install button to install Code Runner, which is a part of what was built in the configuration above.
![](https://thad.getterman.org/wp-content/uploads/2021/04/vscode_recommended_workspace-1024x143.png)
If you were not automatically prompted to install extensions, then you can click View→Extensions.
In the search box, type @recommended:workspace
![](https://thad.getterman.org/wp-content/uploads/2021/04/vscode_project_recommended_extensions_installed-1024x650.png)
VSCode will inform you that Code Runner has now been installed into your new project.
![](https://thad.getterman.org/wp-content/uploads/2021/04/vscode_project_view_explorer-e1618038504105.png)
To return to your project, click View→Explorer.
![](https://thad.getterman.org/wp-content/uploads/2021/04/vscode_rust_main_opened-1024x650.png)
Click src
→main.rs
![](https://thad.getterman.org/wp-content/uploads/2021/04/vscode_proj_run_add_config.png)
Click Run→Add Configuration.
![](https://thad.getterman.org/wp-content/uploads/2021/04/vscode_generate_launch_configs.png)
VSCode will use your open Rust source file, main.rs
, to detect Cargo.toml
.
Click Yes to proceed.
![](https://thad.getterman.org/wp-content/uploads/2021/04/vscode_generate_launch-json-1024x650.png)
.vscode/launch.json
will be created, and then opened.
You may close this file, and proceed to the next step.
![](https://thad.getterman.org/wp-content/uploads/2021/04/vscode_proj_menu_def_build_task.png)
Click Terminal→Configure Default Build Task.
![](https://thad.getterman.org/wp-content/uploads/2021/04/vscode_select_default_task-1024x650.png)
VSCode will ask you to select a task to use as the default build task.
Select Rust: cargo run.
![](https://thad.getterman.org/wp-content/uploads/2021/04/vscode_generate_tasks-json-1024x650.png)
.vscode/tasks.json
will be created, and then opened.
You may close this file, and proceed to the next step.
Table of Contents