Skip to content
| Marketplace
Sign in
Visual Studio Code>Extension Packs>MD Context Injector-extNew to Visual Studio Code? Get it now.
MD Context Injector-ext

MD Context Injector-ext

Prabhat-Test01

|
5 installs
| (0) | Free
Injects MD file content into VS Code agents like Copilot
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

MD Context Injector Extension

Overview

The MD Context Injector is a Visual Studio Code extension designed to enhance AI agents (such as GitHub Copilot) by injecting metadata from Markdown (MD) files as context. This is particularly useful for developers working on applications in C#, .NET Core, or other technologies, where MD files contain project metadata, notes, or configurations. The extension reads raw MD content, caches it persistently across sessions, and seamlessly integrates it into code completions and chat queries without requiring API keys or complex parsing.

Key features include:

  • Single or multi-file MD selection for context building.
  • Persistent caching and automatic updates on file saves, surviving VS Code restarts.
  • Integration with Copilot via inline completions and custom chat participants (invoked with @mdcontext), with progress indicators and error handling.
  • Support for agent mode in VS Code for application enhancements, using modular code structure for better maintainability.

This extension builds on VS Code's extensibility APIs to provide a lightweight, automated workflow for passing MD-based context to AI models.

Installation

  1. Download the .vsix file from the release or package it locally.
  2. In VS Code, go to Extensions view (Ctrl+Shift+X).
  3. Click the three-dot menu and select "Install from VSIX...".
  4. Choose the .vsix file and reload VS Code.

Alternatively, install from the VS Code Marketplace (once published).

Usage

Activating the Extension

  • Open VS Code and press Ctrl+Shift+P to access the Command Palette.
  • Search for and run the command: Read and Inject MD Context.

Selecting MD Files

  • A file dialog will appear, allowing you to select one or more .md files.
  • The raw content from selected files is combined (separated by dividers) and cached persistently.
  • You'll see a notification: "MD contexts cached and ready for injection."

Injecting Context into Agents

  • Inline Completions: In any code file, trigger suggestions (e.g., Ctrl+Space). Look for "Suggestion with MD Context" to insert the cached MD content.
  • Chat Integration: In Copilot Chat, prefix queries with @mdcontext (e.g., @mdcontext Summarize the selected MD file). The extension enriches the prompt with MD context, shows progress indicators, and forwards it to a language model (e.g., GPT-4o family) for processing, with built-in error handling.
  • Auto-Update and Persistence: Saving changes to a selected MD file automatically refreshes the cache, with a confirmation notification. The cache persists across VS Code sessions and restarts.

Example Workflow

  1. Select MD files containing your app's metadata.
  2. In Copilot Chat, query: @mdcontext Suggest code enhancements based on this metadata.
  3. Receive AI responses tailored to the injected context, with progress updates during processing.

Configuration

No additional configuration is required, but you can customize via VS Code settings if needed (e.g., keybindings for the command). The extension uses modular code for easy extension and maintenance.

Known Limitations

  • Requires VS Code version 1.87.0 or later for full Chat API and Language Model support.
  • Works best with GitHub Copilot; compatibility with other agents may vary.
  • Large MD files may truncate in completions—consider splitting files for optimal results.
  • Persistent cache relies on file paths; if files are moved or deleted, reselect them to update.

Contributing

If you'd like to contribute, fork the repository, make changes, and submit a pull request. For issues or suggestions, open a GitHub issue.

License

This extension is licensed under the MIT License. See the LICENSE file for details.

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