The atcoder-rust-devcontainer
repository offers a tailored development environment for competitive programming in the Rust language, specifically for AtCoder contests. Utilizing a devcontainer setup, it simplifies the task of setting up and diving straight into coding challenges without the usual overhead of environment configuration.
-
🔧 Integrated Toolset: Equip yourself with general Rust tools like rust-analyzer, rustfmt, clippy, and the VS Code-specific debugger vscode-lldb. For competitive programming, this environment also integrates cargo-compete and cargo-snippet.
-
🌟 Hassle-Free Setup: Bypass the tedious process of setting up tools individually. Jump directly into competitive programming with everything set up for you.
-
🔍 Optimized for Rust: This devcontainer is fine-tuned for Rust, offering features such as auto-formatting, linting, and debugging for a smooth coding experience.
-
📦 Quick Code Snippets: Leverage the integrated cargo-snippet to create and utilize Rust code snippets effortlessly in Visual Studio Code.
📋 Setting Up Your Environment:
- Copy the
.devcontainer/.env.example
file to.devcontainer/.env
. - Inside the
.devcontainer/.env
file, make sure to set the following:ATCODER_USERNAME
: Replace with your AtCoder username.ATCODER_PASSWORD
: Replace with your AtCoder password.
After updating the values, you'll need to rebuild the devcontainer for the changes to take effect.
By configuring these values correctly, the devcontainer will be able to automatically sign you into the AtCoder platform upon successful rebuild.
This script initializes the development environment:
- 🖇 Copies the example VS Code settings file for rust-analyzer to the appropriate location, if it doesn't already exist.
- 📝 Generates Rust code snippets using
cargo_snippet.sh
. - 🔒 Automatically signs in to the AtCoder website with the provided username and password.
This script sets up a new contest directory and updates the rust-analyzer configuration in the VS Code settings.
- 🖥 Open the terminal within the devcontainer.
- ▶ Run
cargo_compete_new.sh <contest>
where<contest>
is the contest's name.
This script is a workaround for the issue detailed in qryxip/cargo-compete#198. It automates the creation of .gitkeep
files within the in/out
directories of the cargo compete
testcases, ensuring that these directories are tracked by Git even if they are empty.
- 🖥 Open the terminal within the devcontainer.
- ▶ Run the script by typing
create_gitkeep_in_testcases.sh <path_to_contest_directory>
.
The script will iterate over all .yml
files in the <path_to_contest_directory>/testcases
directory and ensure that each corresponding in/out
directory has a .gitkeep
file.
📝 Note:
- When you execute
cargo_compete_new.sh
, thecreate_gitkeep_in_testcases.sh
script is automatically run for the new contest directory. - If you're using
cargo compete add
to add problems, you'll need to runcreate_gitkeep_in_testcases.sh
manually for the specific contest directory.
This script generates Rust code snippets for Visual Studio Code, tailored for competitive programming. It allows you to create custom snippets in the src/lib
directory and make them available for use within Visual Studio Code.
- 🖥 Open the terminal within the devcontainer.
- ▶ Run the script by typing
cargo_snippet.sh
.
This updates the rust.code-snippets
file in the .vscode
directory, making your custom snippets available in Visual Studio Code.
- 📁 Create a new contest directory:
cargo_compete_new.sh abc317
- 🚶 Navigate to the created directory:
cd $WORKSPACE_FOLDER/src/contest/abc317/
- 📝 Solving a Problem (e.g., Problem A):
- 🧪 Execute sample test cases:
cargo compete test a
- 📤 Submit your solution:
cargo compete submit a
- 🧪 Execute sample test cases:
- 🚶 Navigate to your preferred directory:
cd $WORKSPACE_FOLDER/src/{your_directory_of_choice}
- ➕ Add the desired problem:
cargo compete add abc317_a
- 🧪 Execute sample test cases:
cargo compete test abc317_a
- 📤 Submit your solution:
cargo compete submit abc317_a
This project is dual-licensed under MIT or Apache-2.0. For more details, see LICENSE-MIT and LICENSE-APACHE.