Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Simple VSCode ContextNew to Visual Studio Code? Get it now.
Simple VSCode Context

Simple VSCode Context

Brady Zhou

|
2 installs
| (0) | Free
Captures VS Code editor context and stores it in JSON files for external use
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Simple VSCode Context

A VS Code extension that captures your editor context information (open files, selections, workspace folders) and saves it to JSON files for external use.

Features

  • Automatically captures your VS Code context as you work
  • Stores context data in simple JSON files for each project
  • Configurable capture settings - on events or at timed intervals
  • No server required - access context data directly from the files
  • Fast, lightweight, and unobtrusive

How It Works

Simple VSCode Context works by capturing your editor state - which files are open, what text is selected, what workspaces are active - and saves this information to a JSON file. Each workspace/project gets its own context file, stored in a configurable directory.

Unlike server-based approaches, there's no need to run a separate service - the context is saved directly to disk where other applications can access it. This makes it ideal for integration with external tools like AI assistants that need to understand your current workspace context.

Installation

  1. Install the extension from the VS Code marketplace
  2. The extension will automatically start capturing context based on your settings
  3. Context files are stored in ~/.simple-context by default (configurable)

Development and Packaging

Prerequisites

  • Node.js (latest LTS version recommended)
  • Visual Studio Code

Building the Extension

  1. Clone the repository
  2. Install dependencies:
    npm install
    
  3. Build the extension:
    npm run compile
    

Packaging the Extension

  1. Install the packaging tool:
    npm install -g @vscode/vsce
    
  2. Package the extension:
    vsce package
    
    This will generate a simple-context-x.x.x.vsix file

Note: The .vscodeignore file controls which files are included in the package. It excludes development files, external references, and other unnecessary files to keep the package size small.

Installing from VSIX

  1. In VS Code, open the Command Palette (Ctrl+Shift+P)
  2. Type "Extensions: Install from VSIX" and select it
  3. Choose the .vsix file you generated

Publishing to the VS Code Marketplace

  1. Create a publisher account at https://marketplace.visualstudio.com/
  2. Get a Personal Access Token from Azure DevOps
  3. Login to vsce:
    vsce login <publisher-name>
    
  4. Publish the extension:
    vsce publish
    

Usage

The extension runs in the background, automatically capturing your editor context:

  1. As you edit files, switch between files, or change selections
  2. At configurable time intervals
  3. Manually by running the "Capture Context Now" command

Each project's context is stored in its own JSON file, including:

  • Open files
  • Current selections
  • Active editor
  • Workspace folders

Configuration

The following settings are available:

  • simple-context.contextDir: Directory to store context files (default: ~/.simple-context)
  • simple-context.autoCapture: Automatically capture context on file changes (default: true)
  • simple-context.captureInterval: Minimum interval in seconds between context captures (default: 30, set to 0 to disable). This ensures context is saved even during periods of inactivity.

For Developers

Context files are stored as JSON and include:

{
  "timestamp": 1621334567890,
  "activeEditor": {
    "fileName": "src/index.js",
    "selections": [
      {
        "start": {"line": 10, "character": 5},
        "end": {"line": 10, "character": 12}
      }
    ]
  },
  "openFiles": [
    {
      "fileName": "src/index.js",
      "filePath": "/path/to/project/src/index.js",
      "languageId": "javascript"
    },
    {
      "fileName": "src/styles.css",
      "filePath": "/path/to/project/src/styles.css",
      "languageId": "css"
    }
  ],
  "workspaceFolders": [
    {
      "name": "my-project",
      "path": "/path/to/project"
    }
  ]
}

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft