Sample Judge
Sample Judge is a VS Code extension for competitive programming workflows.
It watches configured solution files when you save them, runs sample test cases from your configured layout, and shows the latest results in a dedicated preview panel.
Features
- Auto-run on save for supported files
Sample Judge: Open command that opens the preview beside your editor
- Manual
Run Now action from the preview
- Per-case result cards with separated
stdout and stderr
- In-panel editing and creation for sample test cases
- Empty-state and error-state handling in the viewer
- Configurable watch targets, test directories, and input/output naming rules
Supported workflows
The extension currently supports these default patterns:
- Rust with Cargo multi-bin layouts
- Python with
python3
- C++ with
g++
Out of the box, sample tests are expected under the problem directory as paired files like:
tests/sample-1.in
tests/sample-1.out
You can override this in settings.json, including:
- Which saved files should trigger Sample Judge
- How to resolve the problem directory for a matched source file
- Which directory contains test cases
- How input/output files map to each case name
- How newly added test cases should be named
Example:
{
"autoRunner.watch.targets": [
{
"language": "python",
"match": ["**/solve.py"],
"problemDirTemplate": "{{dir}}/.."
}
],
"autoRunner.tests": {
"directory": "samples",
"inputPattern": "input-{{caseName}}.txt",
"outputPattern": "../answers/output-{{caseName}}.txt"
},
"autoRunner.testCaseCreation": {
"nameTemplate": "case-{{n}}"
}
}
Local verification
npm install
npm run compile
npm test
npm run manual:extension
In normal VS Code usage, run Sample Judge: Open from the command palette to open the preview to the side.
Notes
- This repository uses local fixtures during development.
- Packaging should exclude development-only files such as source tests and local fixture directories.