SampleForge
A competitive programming sample manager and local judge for C/C++ and Python inside VS Code, with Competitive Companion import.
A Chinese version is included as README.zh-cn.md.
Features
- A Problems icon in the Activity Bar with a problem list, source labels, status icons, inline renaming, inline deletion, and browser opening.
- Problem rows show their Competitive Companion
group in small gray text; manually created problems are labelled Local.
- A full-height error panel presents complete compilation failures. Copy and collapse icons sit next to the
[CE] badge; a collapsed error keeps a copy icon and a chevron that expands it again. The collapse state is remembered per sample.
- When compilation succeeds with warnings, a compact warning summary appears in the sample status row with copy and expand buttons; expanding shows the full compiler output. It stays collapsed by default and does not stop testing.
- Input, expected output, and program output panes show line numbers sized to the largest line number in each pane.
- A Samples tab in the bottom panel with editable input/expected output, read-only program output, per-sample status, and one-click testing.
- Receives problems directly from the Competitive Companion browser extension on
127.0.0.1:10043 (configurable), with automatic selection and panel focus.
- Problems and samples are stored as plain JSON in
.vscode/problems.json and can be edited by hand.
- Test results: AC, WA, TLE, MLE, OLE, RE, CE, and UNSUPPORTED.
- Configurable time, memory, output limits, comparison rules, compiler/interpreter, and panel layout.
- Chinese and English UI, following the VS Code display language.
Requirements
- C/C++: a
g++ compatible compiler on PATH (or configure another compiler).
- Python:
python3 on Linux/macOS or python on Windows, or configure an interpreter.
- VS Code 1.85 or newer.
Usage
- Open a workspace folder.
- Set the Competitive Companion browser extension port to
10043 (the default).
- Open a problem page in the browser and click the Competitive Companion icon. The problem appears under Problems and the Samples panel opens.
- Open your
.c, .cc, .cpp, .cxx, or .py source file.
- Use Test this sample or Test all samples in the Samples panel.
You can also use the + button in the Problem List title bar to create a problem manually. The new row starts in an inline name editor with the default name selected; type to replace it, press Enter or click elsewhere to confirm, or press Esc to cancel. The pencil starts the same inline editor for the selected problem. The external-link button opens its URL, and { } opens .vscode/problems.json. Deletion uses the trash icon on each row and does not ask for confirmation.
Commands for keyboard shortcuts
The sample actions are available as commands, so you can bind them in Keyboard Shortcuts:
| Command ID |
Action |
cc.testCurrentSample |
Test the selected sample |
cc.testAllSamples |
Test all samples of the selected problem |
cc.addSample |
Add an empty sample |
cc.deleteCurrentSample |
Delete the selected sample |
cc.openSettings |
Open the SampleForge settings page |
The last selected problem is stored as selectedProblemId in .vscode/problems.json and restored the next time the workspace is opened. Running a test command automatically focuses the Samples panel.
Settings
Search for cc. in Settings.
| Setting |
Default |
Purpose |
cc.compiler |
g++ |
C/C++ compiler (also used for .c) |
cc.compileArgs |
-O2 -std=c++14 |
C/C++ compiler arguments |
cc.pythonInterpreter |
empty |
Python interpreter; auto-detects python3 on Linux/macOS and python on Windows |
cc.pythonArgs |
empty |
Python interpreter arguments |
cc.timeLimit |
1000 ms |
Per-sample time limit |
cc.memoryLimit |
512 MB |
Per-sample memory limit (all platforms) |
cc.outputLimit |
10 KB |
Per-sample output limit |
cc.ignoreTrailingSpaces |
true |
Ignore trailing spaces/tabs during comparison |
cc.ignoreTrailingEmptyLines |
true |
Ignore trailing empty lines during comparison |
cc.sampleLayout |
horizontal |
Show panels side by side or stack them vertically |
cc.focusFirstFailedSample |
true |
After testing all samples, focus the first sample that did not pass |
cc.scrollToFirstWrongLine |
true |
After a test, scroll a WA sample to its first differing line |
cc.showLineNumbers |
true |
Show line numbers beside the input, expected output, and program output panes |
cc.port |
10043 |
Competitive Companion listener port |
The memory limit is enforced on Linux, Windows, and macOS by actively monitoring the process and stopping it when the limit is exceeded. Time and output limits work on all three platforms.
Notes
- The active source file is saved automatically before each test.
- Unsupported file extensions produce an
UNSUPPORTED result without an extra notification.
- Results are saved with the problem data so status icons survive a restart.
- The layout divider ratios are remembered per sample and per layout direction.
License
MIT © 2026 ZBXAPCY
| |