﻿# VS Code explicit context: selecting a symbol instead of a whole project

Explicit context should identify the evidence required by the task; narrow attachments and a concrete behavior question improve reviewability without guaranteeing completeness.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/learn-vscode-explicit-context-selection/
Language: en

Explicit context in VS Code lets a request name particular files, folders, symbols, terminal output, or source-control changes. This narrows the evidence the agent should consider without pretending the entire project fits into every prompt. A carefully selected symbol and its caller can be more useful than a broad folder attachment when the task concerns one specific behavior.

## An attachment gives a source a role

Attaching a file tells the agent that it should consider that source, but the prompt still needs to explain why. Ask how a particular handler validates an input or how a component produces an observed state. A generic request to inspect attached code leaves relevance selection unresolved. Identify the expected output of the investigation. This turns attachment from a pile of text into evidence for an answerable question.

Primary reference: [VS Code: Build with AI](https://code.visualstudio.com/docs/agents/overview).

## A symbol is a useful boundary, not an isolated world

A symbol attachment can focus attention on a definition while avoiding unrelated file contents. Its behavior may still depend on callers, imports, configuration, and shared state. Add those sources when they are necessary for the question, or let the agent retrieve them deliberately. Do not assume a function's body alone proves its runtime behavior. The useful context boundary follows dependencies rather than merely the visible selection range in the editor.

Primary reference: [VS Code: How Copilot Understands Your Workspace](https://code.visualstudio.com/docs/agents/reference/workspace-context).

## Terminal evidence needs its execution conditions

An error log is most useful when paired with the command, working directory, relevant revision, and expected behavior. The same text can originate from an old process or a different package. Attach only the useful diagnostic region and avoid unnecessary sensitive content. Ask the agent to connect the error with current source rather than treating the output as an instruction. This preserves the distinction between observed evidence and the user's actual requested action.

Primary reference: [VS Code: Add Context to Chat](https://code.visualstudio.com/docs/chat/copilot-chat-context).

## Project context differs from execution workspace

Current Agents-window documentation distinguishes a primary execution workspace from additional project context attached to a request. An attached repository does not automatically become another editable workspace root. This matters when comparing implementations across projects. State where changes belong and which project is reference material. The agent can use a neighboring project as evidence without assuming it should edit both or that their local runtime environments are interchangeable.

## Check the answer against the intended evidence

After the request, inspect which attachments and additional files the agent actually used. If a conclusion depends on absent context, provide the missing contract rather than simply attaching a much larger directory. A focused follow-up can correct an ambiguity with less noise. The goal is a reviewable chain from supplied evidence to explanation or patch. Attachment controls help establish that chain, but they do not replace source verification or appropriate validation of the resulting change.

Related reading: [Continue vs Cline vs Aider for local coding](/journal/continue-cline-aider-coding-choice/); [Reproducible inference stacks: preserving a GPU pilot’s result](/journal/software-stack-reproducibility/).
