Skip to content
| Marketplace
Sign in
Visual Studio Code>Debuggers>Ghost: ReplayNew to Visual Studio Code? Get it now.
Ghost: Replay

Ghost: Replay

ghost-vscode

|
2 installs
| (0) | Free
VSCode extension for Ghost error replay system - browse and replay captured errors directly in your editor
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Ghost: Replay - VSCode Extension

A VSCode extension for the Ghost error replay system that allows you to browse and replay captured errors directly in your editor.

Features

  • Explorer Panel: Browse captured error replays organized by function name
  • Replay Actions: Right-click to replay errors and see results in the output channel
  • Inspect Inputs: View serialized function inputs with JSON syntax highlighting
  • CLI Integration: Seamless integration with @sapphy/ghost core library and CLI
  • Configuration: Customize storage path and behavior via VSCode settings

Installation

From VSIX (Development)

  1. Download the .vsix file from releases
  2. Open VSCode
  3. Press Ctrl+Shift+P (or Cmd+Shift+P on Mac)
  4. Type "Extensions: Install from VSIX"
  5. Select the downloaded .vsix file

From Marketplace (Coming Soon)

Search for "Ghost: Replay" in the VSCode Extensions marketplace.

Usage

Prerequisites

Make sure you have a project using @sapphy/ghost with captured error replays:

npm install @sapphy/ghost

Basic Usage

  1. Open the Explorer: The "Ghost Replays" panel appears in the Explorer sidebar when replays are available
  2. Browse Replays: Replays are organized by function name, then by timestamp
  3. Replay Error: Right-click a replay → "Replay Error" to re-execute with captured inputs
  4. Inspect Inputs: Right-click a replay → "Inspect Inputs" to view the JSON data
  5. Copy Inputs: Right-click a replay → "Copy Inputs JSON" to copy to clipboard

Commands

Available via Command Palette (Ctrl+Shift+P):

  • Ghost: Refresh Replays - Reload the replay list
  • Ghost: Clear All Replays - Remove all stored replays (with confirmation)
  • Ghost: Enable Explorer - Show the Ghost Replays panel

Tree View Structure

FunctionA
  └── 2025-01-15 10:42:33 → TypeError: Cannot read property...
  └── 2025-01-14 16:21:15 → ReferenceError: x is not defined
FunctionB
  └── 2025-01-13 14:55:22 → Error: Invalid input parameter

Configuration

Configure the extension via VSCode Settings (Ctrl+,):

{
  "ghost.storagePath": ".ghost/",
  "ghost.autoRefresh": true
}

Settings

  • ghost.storagePath: Path to Ghost storage directory relative to workspace root (default: .ghost/)
  • ghost.autoRefresh: Automatically refresh replay list when files change (default: true)

Integration with Ghost Library

This extension integrates with:

  • @sapphy/ghost: Core library for error capturing and replay
  • @sapphy/ghost-cli: Command-line interface (optional)

Example Code

import { withGhost, registerFunction } from '@sapphy/ghost'

// Wrap functions with Ghost
const riskyFunction = withGhost('riskyFunction', (x: number) => {
  if (x < 0) throw new Error('Negative numbers not allowed')
  return x * 2
})

// Register for replay capability
registerFunction('riskyFunction', riskyFunction)

// Errors are automatically captured and available in VSCode
riskyFunction(-5) // This will be captured

Output Channel

Results and logs are displayed in the "Ghost: Replay" output channel:

  • Replay execution results
  • Success/failure status
  • Execution time
  • Error details and stack traces

Development

Building from Source

# Clone repository
git clone https://github.com/feizk/ghost.git
cd ghost/vscode

# Install dependencies
npm install

# Build extension
npm run build

# Package extension
npm run package

Development Mode

# Watch mode for development
npm run dev

# Type checking
npm run type-check

# Linting
npm run lint
npm run lint:fix

Troubleshooting

No Replays Visible

  1. Ensure your project uses @sapphy/ghost
  2. Check that functions are registered with registerFunction()
  3. Verify storage path in settings matches your project structure
  4. Try refreshing with the refresh button

Replay Fails

  1. Ensure original functions are registered for replay
  2. Check the output channel for detailed error messages
  3. Verify function names match between capture and replay

Performance Issues

  1. Clear old replays using "Clear All Replays"
  2. Adjust storage path to avoid large directories
  3. Disable auto-refresh if needed

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make changes with tests
  4. Submit a pull request

License

MIT - see LICENSE file for details.

Links

  • GitHub Repository
  • Documentation
  • Issue Tracker
  • Ghost Core Library
  • Ghost CLI
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft