Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Instant Context QueryNew to Visual Studio Code? Get it now.
Instant Context Query

Instant Context Query

Toshihide KAWAI

| (0) | Free
A Cursor extension that automatically creates and inputs prompts to get AI explanations for selected text
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Instant Context Query

A Cursor extension that automatically creates and inputs prompts to get AI explanations for selected text

Features

  • 📝 Get AI explanations for selected text in the editor or chat screen using Cursor AI
  • ⌨️ Execute instantly with a shortcut key (Alt+- / Option+-)
  • 🖱️ Select "Ask Cursor AI" from the right-click menu
  • 💬 Automatically opens Cursor's chat tab and inputs the prompt
  • 🔧 Works in both editor and chat screens

Installation

Install from VS Code Marketplace (Recommended)

  1. Open VS Code (or Cursor)
  2. Open the Extensions view (Ctrl+Shift+X / Cmd+Shift+X)
  3. Search for "Instant Context Query"
  4. Click "Install"

Manual Installation (Development Version)

  1. Clone or download this repository
  2. Install dependencies:
    npm install
    
  3. Build the extension:
    npm run compile
    
  4. Package the extension:
    npm install -g @vscode/vsce
    vsce package
    
  5. Install the generated .vsix file:
    • Press Ctrl+Shift+P (Mac: Cmd+Shift+P) in VS Code
    • Select "Extensions: Install from VSIX..."
    • Select the .vsix file

Usage

  1. Select the text you want to explain in the editor or chat screen
  2. Press Alt+- (Windows/Linux) or Option+- (Mac)
    • Or select "Ask Cursor AI" from the right-click menu
  3. Cursor's chat tab will open and the prompt will be automatically entered
  4. Press Enter to send

Configuration

This extension uses Cursor's chat functionality, so no additional configuration is required.

Customizing the Prompt

You can customize the prompt template used when asking AI to explain selected text:

  1. Open VS Code settings (Ctrl+, / Cmd+,)
  2. Search for "Instant Context Query"
  3. Set "Instant Context Query: Prompt Template"
  4. Use {selectedText} as a placeholder for the selected text

Example:

Please explain the following code in detail:

{selectedText}

Focus on the logic and purpose of each part.

If the prompt template is empty, the default prompt based on your VS Code language setting will be used.

Changing the Shortcut Key

To change the shortcut key:

  1. Open keyboard shortcut settings with Ctrl+K Ctrl+S (Mac: Cmd+K Cmd+S)
  2. Search for "Instant Context Query" or "Ask Cursor AI"
  3. Change the shortcut key

Development

Requirements

  • Node.js 18 or higher
  • TypeScript 5.0 or higher
  • VS Code 1.74 or higher

Development Commands

# Compile
npm run compile

# Watch mode (auto-compile)
npm run watch

Debugging

Basic Debugging Steps

  1. Open the project

    • Open this project folder in VS Code
  2. Launch Extension Development Host

    • Press F5 or select "Run Extension" from the debug panel
    • A new VS Code window (Extension Development Host) will open
  3. Set Breakpoints

    • Click on the left side of any line in src/extension.ts to set a breakpoint
    • A red circle will appear
  4. Test the Extension

    • In the development host window, open an editor and select text
    • Press Alt+- (Windows/Linux) or Option+- (Mac) to execute the command
    • Or right-click and select "Ask Cursor AI"
    • Execution will stop at the breakpoint
  5. Check Debug Information

    • View Variables: Check variable values in the left debug panel
    • Watch Expressions: Add expressions to monitor values
    • Call Stack: View function call history
    • Debug Console: Check console.log output

Debugging Tips

  • Log Output: extension.ts includes detailed log output
    • Check emoji logs like 🚀, 📝, ✅, ❌ in the debug console
  • Watch Mode: Running npm run watch will auto-compile when code changes
  • Restart: If you change the extension code, restart the development host (Ctrl+R or Cmd+R)

Common Issues

  • Breakpoints not working:

    • Run npm run compile to check if source maps are generated
    • Check if the out/extension.js.map file exists
  • Extension not loading:

    • Run "Reload Extension" in the development host window
    • Or close the development host and launch again with F5

License

MIT License

Copyright (c) 2025 Toshihide KAWAI

See the LICENSE file for details.

Contributing

Pull requests and issue reports are welcome!

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