Alex Merced's Data, Dev and AI Blog

Context Management Strategies for VS Code with LLM Plugins: A Complete Guide to Building Your Own AI-Powered IDE

2026-03-07 | 11 min read | AI, Context Management, Developer Tools

Cover Image

Visual Studio Code is the most widely used code editor in the world, and its extensibility means you can integrate AI capabilities through a growing ecosystem of LLM plugins. Unlike purpose-built AI editors (Cursor, Windsurf, Zed), VS Code gives you the freedom to choose and combine AI extensions, configure them to your preferences, and even switch between providers without changing editors. The tradeoff is that context management is not as seamlessly integrated as in dedicated AI editors. It requires more deliberate configuration.

This guide covers context management strategies for the most popular VS Code AI extensions: GitHub Copilot, Continue, Cline (formerly Claude Dev), Aider, and others. It explains what context management capabilities each offers and how to configure them for maximum effectiveness.

The VS Code AI Extension Landscape

VS Code's AI extension ecosystem falls into several categories:

Category Extensions Approach
Inline completion GitHub Copilot, CodeiumChat, Supermaven Suggest code as you type
Chat panel Copilot Chat, Continue, Cody Conversational AI in a sidebar
Agentic coding Cline, Aider, Roo Code Autonomous agents that read/write files
Specialized Mintlify, Tabnine Documentation, enterprise-focused

Each category manages context differently. Inline completion plugins use the current file and nearby tabs. Chat panel plugins use conversation history and file references. Agentic plugins have the broadest context, reading the codebase, running commands, and making multi-file changes.

GitHub Copilot: Context Management

GitHub Copilot is the most widely used AI coding assistant. Its context management has evolved significantly with the introduction of Copilot Chat and Agent Mode.

Inline Completions

Copilot's inline suggestions use:

  • The current file content (especially the lines around your cursor)
  • Open tabs in the editor (nearby files provide additional context)
  • File names and directory structure (for naming conventions)
  • Comment and docstring context (comments above your cursor guide suggestions)

Tip: Keep related files open in tabs. Copilot considers open files as context, so having related source files, type definitions, and tests open improves suggestion quality.

Copilot Chat

Copilot Chat operates in the sidebar with conversation-based interaction:

  • Use #file to reference specific files
  • Use #editor to reference the active editor content
  • Use #selection to reference selected code
  • Use #codebase to search the workspace
  • Use @workspace to ask questions about the entire project

Copilot Agent Mode

Agent Mode (introduced in 2025) makes Copilot an autonomous agent that can:

  • Plan multi-step changes
  • Read and write files across the project
  • Run terminal commands
  • Make and verify changes iteratively

Agent Mode uses the broadest context of any Copilot feature: it can explore the codebase, read package.json, check test results, and understand project structure before making changes.

Custom Instructions for Copilot

Create a .github/copilot-instructions.md file in your project root:

# Copilot Instructions

## Code Style
- Use TypeScript strict mode
- Prefer functional components with hooks
- Use named exports, not default exports
- Follow the Airbnb ESLint configuration

## Testing
- Write tests using Vitest
- Use React Testing Library for component tests
- Mock API calls with MSW

## Architecture
- Components go in src/components/
- API clients go in src/api/
- Shared types go in src/types/

These instructions are loaded by Copilot for every interaction within the project, functioning like .cursor/rules/ in Cursor.

Continue: Open-Source AI Extension

Continue is an open-source VS Code extension that supports multiple LLM providers and offers extensive context management features.

Provider Configuration

Continue supports:

  • OpenAI, Anthropic, Google models via API keys
  • Ollama for local models
  • Any OpenAI-compatible endpoint

Context Providers

Continue's "@-mention" context system includes:

Context Provider Function
@file Include a specific file
@code Include code blocks from the codebase
@docs Search indexed documentation
@codebase Semantic search across the project
@terminal Include recent terminal output
@diff Include current Git diff
@repo Include repository metadata
@folder Include folder structure

.continuerc.json Configuration

{
  "models": [
    {
      "title": "Claude Sonnet",
      "provider": "anthropic",
      "model": "claude-sonnet-4-20250514",
      "apiKey": "your-key"
    },
    {
      "title": "Local Llama",
      "provider": "ollama",
      "model": "llama3.1:70b"
    }
  ],
  "customCommands": [
    {
      "name": "review",
      "prompt": "Review this code for security issues, performance problems, and style violations."
    }
  ],
  "docs": [
    {
      "title": "React Docs",
      "startUrl": "https://react.dev/reference"
    }
  ]
}

Why Continue Stands Out for Context

Continue's open-source nature means you can inspect exactly how context is assembled. Its support for custom context providers extends beyond built-in options, allowing teams to create project-specific context sources.

Cline (formerly Claude Dev): Agentic Coding Agent

Cline is a VS Code extension that turns Claude into an autonomous coding agent within the editor.

Context Capabilities

Cline has one of the broadest context scopes among VS Code extensions:

  • Reads and writes files across the entire project
  • Runs terminal commands
  • Browses the web (for documentation lookup)
  • Takes screenshots of running applications
  • Manages its own task history

Project Instructions

Create a .clinerules file in your project root:

# Project: SaaS Application

## Stack
- Python 3.12 with FastAPI
- PostgreSQL with SQLAlchemy
- Redis for caching
- React frontend with TypeScript

## Build Commands
- Backend: `uvicorn app.main:app --reload`
- Frontend: `npm run dev`
- Tests: `pytest -v`

## Conventions
- All API responses use the ResponseModel pattern
- Database sessions are managed by dependency injection
- Frontend state uses React Query for server state

Custom MCP Servers

Cline supports MCP servers configured through its settings panel, enabling connections to databases, APIs, and other external tools directly within the VS Code environment.

Context Window Management

Cline tracks context window usage and can summarize previous conversation history when the window fills up. This automatic context management prevents the common problem of long sessions degrading quality.

Aider: Git-Aware AI Pair Programmer

Aider integrates with VS Code as a terminal-based tool that focuses on Git-aware code modifications.

Context Management in Aider

Aider uses a unique context model:

  • Chat files: Files actively being discussed and modified
  • Watch files: Files included as read-only context
  • Repository map: An overview of the entire repository structure that fits in context

Commands for Context Control

/add src/auth/middleware.ts    # Add to chat context (can be edited)
/read docs/architecture.md     # Add as read-only context
/drop src/auth/middleware.ts   # Remove from context
/map                           # Show the repository map

The Repository Map

Aider's repository map is a compressed representation of your entire codebase (file names, function signatures, class definitions) that fits within the context window. This gives the AI a bird's-eye view of the project without consuming the entire context budget.

Thinking About Context Levels Across Extensions

Minimal Context (Quick Completions)

For inline code completions, Copilot and Supermaven work well with minimal setup. Keep related files open in tabs and let the extension use the editor context.

Moderate Context (Feature Development)

Use a chat extension (Copilot Chat, Continue) with explicit file references. The @-mention system lets you include exactly the files relevant to the current task.

Comprehensive Context (Major Refactoring)

Use an agentic extension (Cline, Copilot Agent Mode) that can explore the codebase, run tests, and make changes across multiple files. Configure project instructions (.clinerules, copilot-instructions.md, .continuerc.json) to ensure the agent follows your conventions.

External Documents: PDFs vs. Markdown

Markdown Is Universal

All VS Code AI extensions work natively with Markdown. Project instructions, coding standards, and architecture documents should be Markdown files in your repository.

PDFs

Most VS Code extensions do not parse PDFs directly. If you have reference material in PDF form, extract relevant sections into Markdown files. Some extensions (like Cline with web browsing) can fetch online documentation, reducing the need for local PDF conversion.

Documentation Indexing

Continue and Copilot Chat support documentation indexing through @docs. Add your framework documentation URLs to the extension configuration so the AI can reference current documentation during conversations.

MCP Server Support

MCP support varies by extension:

Extension MCP Support Configuration
Cline Yes Settings panel
Continue Yes config.json
Copilot Limited Through GitHub integration
Aider No Direct terminal commands instead

For extensions that support MCP, the configuration follows the standard pattern: specify the server command, arguments, and environment variables. MCP tools become available within the extension's chat or agent interface.

settings.json: Centralizing AI Configuration

VS Code's settings.json is where many AI extensions read their configuration. Here are common settings patterns:

Per-Workspace Settings

Create a .vscode/settings.json file in your project to configure AI extensions per-project:

{
  "github.copilot.enable": {
    "markdown": true,
    "plaintext": false
  },
  "continue.enableTabAutocomplete": false,
  "cline.customInstructions": "Follow the conventions in INSTRUCTIONS.md"
}

Per-workspace settings override user-level settings, allowing you to tailor AI behavior to each project's needs.

Workspace Trust and Security

VS Code's Workspace Trust feature is important when using AI extensions. In untrusted workspaces, some extensions may limit their capabilities (for example, restricting file access or command execution). This is a security feature: it prevents untrusted code from being automatically processed by AI tools that have file system access.

For your own projects, trust the workspace to enable full AI capabilities. For third-party codebases, consider the implications before trusting.

When to Use VS Code with Plugins vs. Dedicated AI Editors

Choose VS Code with plugins when:

  • You already use VS Code and want to add AI incrementally
  • You want to mix and match extensions from different providers
  • You have existing VS Code extensions and workflows you cannot replicate elsewhere
  • You need the specific capabilities of an extension that only exists for VS Code (like Cline)
  • Your team uses different AI providers and needs a common editor

Choose Cursor or Windsurf when:

  • You want the most seamlessly integrated AI experience
  • You prefer automatic codebase indexing over manual context management
  • You are starting fresh and do not have an existing VS Code extension stack
  • You want features like .cursor/rules/ or Cascade flows that are deeply integrated

Choose a terminal agent (Claude Code, Gemini CLI) when:

  • Your workflow is terminal-centric
  • You need direct shell command execution as your primary interaction
  • You prefer a focused, distraction-free coding experience

Advanced Patterns

The Multi-Extension Stack

Use multiple extensions simultaneously for different purposes:

  • Copilot for inline completions (fast, low-friction)
  • Continue for chat with @codebase search (exploratory questions)
  • Cline for agentic tasks (multi-file changes, complex features)

Each extension handles a different level of context and interaction.

The Consistent Instructions Pattern

Maintain a single INSTRUCTIONS.md file in your project root and reference it from each extension's configuration:

  • .github/copilot-instructions.md imports or mirrors INSTRUCTIONS.md
  • .continuerc.json references INSTRUCTIONS.md
  • .clinerules mirrors the same conventions

This ensures consistent behavior regardless of which extension handles the task.

The Provider Rotation Pattern

Use different providers for different extensions:

  • Copilot: GitHub's infrastructure (fast, always available)
  • Continue: Anthropic API (strong at code analysis)
  • Cline: Local Ollama model (privacy for sensitive code)

This gives you the benefits of multiple providers within a single editor.

Common Mistakes

  1. Using too many AI extensions simultaneously. Running five AI extensions creates conflicts, performance overhead, and conflicting suggestions. Pick a primary stack and disable the rest.

  2. Not configuring project instructions. Every AI extension supports some form of project-level instructions. Without them, the AI relies on generic conventions.

  3. Ignoring @codebase search. Both Copilot Chat and Continue offer codebase search. Using it produces more relevant responses than manually specifying files.

  4. Not keeping related tabs open. Inline completion quality improves when related files are open in the editor. Keep type definitions, tests, and related source files in your tab bar.

  5. Choosing the wrong extension for the task. Inline completions for quick code, chat for questions, agent mode for complex changes. Match the tool to the task.

  6. Skipping documentation indexing. If you are working with a framework, index its documentation so the AI references current, accurate information rather than potentially outdated training data.

Go Deeper

To learn more about AI-assisted development and context management strategies, check out these resources by Alex Merced:

And for a fictional take on where AI is heading:

Check out these related posts:

📬 Join the Mailing List

Get updates directly to your inbox.

Subscribe Now

Menu

Search