Skip to content

langningchen/cph-ng

Repository files navigation

CPH-NG

简体中文 | English

Quickly compile, run and judge competitive programming problems in VSCode. Automatically download testcases, or write & test your own problems.

This is the next generation of the Competitive Programming Helper.

Features

  • Automatic compilation with display for compilation errors.
  • Intelligent judge with support for signals, timeouts and runtime errors.
  • Works with Competitive Companion.
  • Works locally for your own problems.
  • Support for several languages.

Comparison with CPH

Feature CPH CPH-NG
Automatic Compilation
Intelligent Judge
Competitive Companion
Local Problem Support
Language Support ✅ C/C++ and 8 others ⚠️ Only C/C++ and Java
Auto-submit Integration ✅ Codeforces and Kattis ⚠️ Only Codeforces
Load Local Testcases
Supported Result ⚠️ Only 3 ✅ AC and 10 others 1
Store Result and Time
Cache compiled program 2
SPJ and interactive
Brute Force Compare

Development

Prerequisites

Local Development Setup

  1. Clone the repository

    git clone https://github.com/langningchen/cph-ng.git
    cd cph-ng
  2. Install dependencies

    pnpm install
  3. Set up Git hooks (for translation checking)

    pnpm run install-hooks
  4. Start development

    pnpm run watch
  5. Open in VSCode

    • Open the project folder in VSCode
    • Press F5 to start debugging
    • A new Extension Development Host window will open with CPH-NG loaded

Development Scripts

  • pnpm run watch - Start development build with file watching
  • pnpm run compile - Build for production
  • pnpm run lint - Run ESLint
  • pnpm run check-translations - Check translation completeness
  • pnpm run install-hooks - Install Git pre-commit hooks
  • pnpm run package - Package the extension as .vsix

Translation Management

This project supports internationalization (i18n) with automatic translation checking:

Adding New Translations

  1. Extension Configuration (package.json)

    • Add %key% references in package.json
    • Add translations in package.nls.json (English)
    • Add translations in package.nls.zh.json (Chinese)
  2. Runtime Messages (Extension code)

    • Use l10n.t('key') in TypeScript code
    • Add translations in l10n/bundle.l10n.zh-cn.json
  3. Webview UI (React components)

    • Use t('key') in React components
    • Add translations in src/webview/l10n/en.json (English)
    • Add translations in src/webview/l10n/zh.json (Chinese)

Translation Checking

  • Automatic: Pre-commit hook checks translation completeness
  • Manual: Run pnpm run check-translations
  • Bypass: Use git commit --no-verify (not recommended)

Building and Packaging

  1. Development Build

    pnpm run compile
  2. Create VSIX Package

    pnpm run package
  3. Install Locally

    code --install-extension cph-ng-*.vsix

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature
  3. Make changes and ensure translations are complete
  4. Commit your changes (pre-commit hook will check translations)
  5. Push to your branch: git push origin feature/your-feature
  6. Create a Pull Request

Debugging

  • Extension Host: Press F5 in VSCode to start debugging
  • Webview: Open Chrome DevTools in the webview panel
  • Logs: Check VSCode Output panel (CPH-NG channels)
  • Compilation: Check Output panel (CPH-NG Compilation channel)

License

This project is licensed under the terms of the GNU Affero General Public License v3.0.

Known Issues

See GitHub Issues.

Change Log

See CHANGELOG.md

Footnotes

  1. They are: AC PC PE WA TLE OLE RE CE SE SK RJ

  2. CPH-NG calculates a hash of the current source code. If the hash matches the last one, it skips the compile process to emit the running time.

About

This is the next generation of the Competitive Programming Helper.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 11