Competitive Programming Helper for Zed - seamlessly receive problems from competitive-companion and generate solution templates with test cases.
CPH for Zed integrates with the popular competitive-companion browser extension to streamline your competitive programming workflow. Parse problems from 100+ online judges including Codeforces, AtCoder, LeetCode, and more.
- 📋 Problem Parsing: Receive problems directly from competitive-companion
- 📝 Smart Templates: Generate solution files with language-specific templates (C++, Python, Rust, Java)
- 🧪 Test Case Management: Automatically create input/output test files
- 📁 Organized Structure: Problems are neatly organized by contest and problem name
- 🔗 Metadata Tracking: Keep track of problem URLs, time limits, and memory constraints
Works with all websites supported by competitive-companion, including:
- Codeforces
- AtCoder
- LeetCode
- CodeChef
- HackerRank
- SPOJ
- CSES
- And 100+ more
- Open Zed
- Open the Extensions panel (
Cmd+Shift+Xon macOS,Ctrl+Shift+Xon Linux) - Search for "Competitive Programming Helper" or "CPH"
- Click Install
git clone https://github.com/ashusevim/cph-zed.git
cd cph-zedThen in Zed: Extensions → Install Dev Extension → Select the cph-zed directory
Install the browser extension:
cargo install cph-servercph-server --port 10045 --dir ./problems- Navigate to any problem on Codeforces, AtCoder, etc.
- Click the competitive-companion icon in your browser
- Solution files appear automatically in your workspace!
Use these slash commands in Zed's AI assistant panel:
| Command | Description |
|---|---|
/cph-fetch <json> |
Create problem files from pasted JSON |
/cph-run [n] |
Show command to run test case n (or all) |
/cph-test |
Show command to test against all cases |
/cph-server |
Info about the companion server |
When you parse a problem, CPH creates this structure:
problems/
└── Codeforces_-_Educational_Round_123/
└── A_Example_Problem/
├── A_Example_Problem.cpp # Solution template
├── problem.json # Problem metadata
└── tests/
├── 1.in # Sample input 1
├── 1.out # Expected output 1
├── 2.in # Sample input 2
└── 2.out # Expected output 2
#include <bits/stdc++.h>
using namespace std;
void solve() {
// Your solution here
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
// cin >> t; // Uncomment for multiple test cases
while (t--) solve();
return 0;
}Templates are also available for Python, Rust, and Java.
cph-server [OPTIONS]
Options:
-p, --port <PORT> Port to listen on [default: 10045]
-d, --dir <DIR> Directory for problem files [default: .]
-l, --language <LANG> Template language: cpp, python, rust, java [default: cpp]
-n, --notify Enable desktop notifications [default: true]
-h, --help Print help
-V, --version Print version
- Zed editor (latest version recommended)
- competitive-companion browser extension
- Rust (for building the companion server)
Contributions are welcome! Please feel free to submit issues or pull requests.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- competitive-companion - Browser extension for parsing problems
- cph-server - Companion HTTP server (published separately)
- CPH for VS Code - Similar extension for VS Code
This project is licensed under the MIT License - see the LICENSE file for details.
- jmerle for creating competitive-companion
- The Zed team for the excellent extension API
- The competitive programming community