Skip to content

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

git clone https://github.com/bamr87/vs-sonic-pi.git
cd vs-sonic-pi
npm install
npm run build

Running the Extension

  1. Open the project in VS Code
  2. Press F5 to launch the Extension Development Host
  3. Open or create a .spi file in the new window
  4. Make sure Sonic Pi is running to test the connection

Running Tests

npm test            # run all tests once
npm run test:watch  # run tests in watch mode

Linting

npm run lint

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.subscriptions or cleaned up in dispose()
  • Prefer async/await over raw promises
  • Prefix unused parameters with _

Making Changes

Branch Naming

  • feature/<short-description> for new features
  • fix/<short-description> for bug fixes
  • docs/<short-description> for documentation changes
  • chore/<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

  1. Fork the repository and create your branch from main
  2. Make your changes and add tests where appropriate
  3. Run npm run lint and npm test to verify everything passes
  4. Update documentation if your change affects user-facing behavior
  5. 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:

  1. Clone the Sonic Pi repository alongside this project
  2. Run SONIC_PI_PATH=/path/to/sonic-pi npm run extract-data

Reporting Issues

License

By contributing, you agree that your contributions will be licensed under the MIT License.