VSForces
VSForces bridges Codeforces with VS Code - giving you a full competitive programming workflow without leaving your editor.
- Browse and fetch random problems by rating
- Read the full problem statement (with LaTeX math) in the VS Code sidebar
- Test cases auto-load into CPH Judge in your currently open file - no new file created, no language prompt
- Track submission verdicts in real time
- Built-in per-problem stopwatch
- Auto-commit & push accepted solutions to GitHub with a detailed README
How It Works
VSForces is made of two parts that work together:
Codeforces Page
│ (content script scrapes problem)
▼
Chrome Extension ──────────────────────┐
│ WebSocket ws://127.0.0.1:6543 │
▼ │
VS Code Extension ◄─────────────────────┘
├── Sidebar (problem statement + timer)
├── Writes .prob file → CPH Judge auto-detects
└── Auto-commit on Accepted → GitHub
You need both installed for VSForces to work.
Requirements
Node.js is NOT required - you are installing a pre-built extension, not building from source.
Installation
Step 1 - Install the VS Code Extension
Option A: From the VS Code Marketplace (recommended)
- Open VS Code
- Go to the Extensions view (
Ctrl+Shift+X)
- Search for VSForces
- Click Install
Alternative: install from a .vsix file
- Download the latest
vsforces-<version>.vsix
- Open VS Code -> Extensions view (
Ctrl+Shift+X)
- Click the
... menu -> Install from VSIX...
- Choose the downloaded file
Step 2 - Install CPH Judge
- Open VS Code
- Go to the Extensions view (
Ctrl+Shift+X)
- Search for Competitive Programming Helper
- Install the extension by DivyanshuAgrawal
Step 3 - Install the Chrome Extension
The companion browser extension is required to connect Codeforces to VS Code.
- Go to the VSForces-Bridge GitHub repository
- Follow the instructions in the repository's README to load the extension into Chrome or Edge
Pin the extension to your toolbar for easy access.
Step 4 - Set CPH Default Language (Recommended)
To prevent CPH from prompting for a language every time:
- Open VS Code Settings (
Ctrl+,)
- Search for
cph.general.defaultLanguage
- Set it to your preferred language:
cpp, java, python, etc.
Usage
Before You Start
Open your solution file in VS Code (Main.java, solution.cpp, etc.) before browsing to a problem. CPH loads test cases into whichever file is currently active.
Fetch a Random Problem
- Click the VSForces icon in the VS Code Activity Bar (left sidebar)
- Set Min / Max rating in the sidebar
- Click Get random problem
- The problem opens in Chrome and the statement appears in the sidebar with test cases loaded in CPH automatically
Browse to Any Problem Manually
Navigate to any Codeforces problem page in Chrome - the sidebar and CPH update automatically.
Submit & Track Verdict
Submit on Codeforces as normal. The verdict appears in the sidebar within ~60 seconds.
Timer
A stopwatch starts automatically when a new problem loads. You can pause, resume, or reset it manually. It stops automatically on Accepted.
Auto-Commit & Push
When you get Accepted on a problem, VSForces can automatically commit your solution to a Git repository and push it to GitHub.
What Gets Committed
For each solved problem, a folder Codeforces/<Problem Title>/ is created containing:
solution.<ext> — your accepted code
README.md — a detailed summary including:
- Problem link, rating, time/memory limits
- Tags
- Full problem statement (converted from HTML)
- Sample test cases with input/output
Setup
- Open VS Code Settings (
Ctrl+,)
- Search for
autogitcommit
- Enable the
Autogitcommit: Enable setting
On first use, VSForces will guide you through setup:
- If your workspace isn't a Git repo → prompts to run
git init
- If no remote is configured → asks you to enter a remote URL (e.g.
https://github.com/user/repo.git)
- If no upstream branch is set → automatically runs
git push -u origin <branch>
Robustness
The auto-commit feature handles common edge cases automatically:
- Unsaved files are saved before committing
- Special characters in problem titles (
/, \, :, ?, etc.) are sanitized for valid folder names
- Remote changes are pulled (with rebase) before pushing to avoid rejection
- Dirty working tree changes are stashed before pull and restored after
- Rebase conflicts are auto-aborted to keep your workspace clean
- Duplicate submissions of the same solution show "Already committed" instead of erroring
- Concurrent verdicts are queued — only one commit runs at a time
Settings
| Setting |
Default |
Description |
autogitcommit.enable |
false |
Enable auto-commit on Accepted |
autogitcommit.push |
true |
Push to remote after committing. Set false for local-only commits |
autogitcommit.commitMessage |
Solve - ${title} |
Commit message template. ${title} is replaced with the problem title |
autogitcommit.githubAccount |
(empty) |
Preferred GitHub username for push authentication. Prevents the account picker from appearing |
vsforces.confirmBeforeSubmit |
true |
Show a confirmation dialog before submitting code to Codeforces |
Features
| Feature |
Details |
| Problem statement |
Full LaTeX rendering via KaTeX, images included |
| Sample test cases |
Shown inline in the sidebar |
| Submit from VS Code |
Auto-detects language from file extension (C, C++, Java, Python, Kotlin, Go, Rust, JS) |
| CPH integration |
Writes .prob file directly - no file creation, no language prompt |
| CPH auto-refresh |
CPH panel updates immediately without switching tabs |
| Random problem |
Filters by rating range, contest year, and tags |
| Problem navigation |
Back/forward through your last 4 problems |
| Verdict tracking |
Real-time verdict display with submission history |
| Auto-commit |
Commits accepted solutions with detailed README to GitHub |
| Streak tracker |
Tracks your daily solve streak |
| State persistence |
Ratings, current problem, verdict, and timer survive sidebar panel switches |
| Zoom |
Ctrl+Scroll or pinch to zoom the sidebar; Ctrl+0 to reset |
| Editorial link |
Quick link to the editorial when available |
Troubleshooting
| Problem |
Fix |
| Sidebar shows "Extension not connected" |
Make sure both the VS Code extension and the Chrome extension are installed and active |
| Test cases not loading in CPH |
Open your solution file in VS Code before navigating to the problem |
| CPH shows old test cases |
A brief split-pane flicker triggers the CPH reload - this is expected behavior |
<br> appears in test case input |
Reload the Chrome extension: go to chrome://extensions and click the refresh icon on VSForces Bridge |
| Problem statement not appearing |
Navigate to a Codeforces problem page - the statement loads on page visit |
| Chrome extension not connecting |
The Chrome extension auto-reconnects within seconds. Ensure VS Code is open — if it still doesn't connect after ~30s, reload the Chrome extension at chrome://extensions |
| Auto-commit failed |
Check that Git is installed, workspace is a Git repo, and a remote is configured |
| Auto-commit already in progress |
Wait for the current commit to finish — concurrent operations are queued |
| GitHub asks which account to use |
Set autogitcommit.githubAccount to your preferred username in VS Code Settings |
| Push rejected (fetch first) |
This is handled automatically — the extension pulls before pushing. If it persists, run git pull manually |
License
Proprietary - All rights reserved. See the LICENSE file for details.