Contributing to Sonic Pi for VS Code¶
How to set up, build, test and lint the extension locally, and the branch, commit and pull request conventions for contributing.
Thank you for your interest in contributing! This guide will help you get started.
Development Setup¶
Prerequisites¶
Getting Started¶
Running the Extension¶
- Open the project in VS Code
- Press F5 to launch the Extension Development Host
- Open or create a
.spifile in the new window - Make sure Sonic Pi is running to test the connection
Running Tests¶
Linting¶
Project Structure¶
src/
├── extension.ts # Entry point — activation, wiring
├── commands/ # Run, Stop command handlers
├── config/ # ConfigManager (VS Code settings)
├── connection/ # OSC transport, heartbeat, port discovery
├── data/ # sonic-pi-data.json (synths, samples, FX, etc.)
├── language/ # Completions, hover, diagnostics, snippets
├── log/ # Log output channel and formatting
├── types/ # TypeScript type definitions
└── ui/ # Status bar, tree views, webviews
See docs/00-architecture.md for the architecture overview, the docs index for every design document, and the PRD for the full product requirements. AGENTS.md is the canonical guide to the commands and conventions.
Code Style¶
- TypeScript with strict mode
- ESLint for linting (
npm run lint) - Prettier for formatting (config in
.prettierrc) - Use the disposable pattern — all subscriptions and resources must be pushed to
context.subscriptionsor cleaned up indispose() - Prefer
async/awaitover raw promises - Prefix unused parameters with
_
Making Changes¶
Branch Naming¶
feature/<short-description>for new featuresfix/<short-description>for bug fixesdocs/<short-description>for documentation changeschore/<short-description>for maintenance tasks
Commit Messages¶
Use clear, imperative-mood messages:
Add hover documentation for FX parameters
Fix heartbeat timeout on slow connections
Update README with new keybinding table
Pull Request Process¶
- Fork the repository and create your branch from
main - Make your changes and add tests where appropriate
- Run
npm run lintandnpm testto verify everything passes - Update documentation if your change affects user-facing behavior
- Open a pull request with a clear description of the changes
Updating Sonic Pi Data¶
The extension's language data (synths, samples, FX, scales, chords) is extracted from the Sonic Pi source. To regenerate it:
- Clone the Sonic Pi repository alongside this project
- Run
SONIC_PI_PATH=/path/to/sonic-pi npm run extract-data
Reporting Issues¶
- Use the bug report template for bugs
- Use the feature request template for ideas
License¶
By contributing, you agree that your contributions will be licensed under the MIT License.