Use chat in VS Code
Chat in Visual Studio Code lets you use natural language for interacting with AI agents. Ask questions about your code, get help understanding complex logic, generate new features, fix bugs, and more, all through a conversational interface.
This article describes interaction mechanics shared by chat surfaces in VS Code, including how to send and steer requests, add context, generate and edit images, navigate a conversation, and personalize the chat display. For an introduction to AI workflows, agents, and the available interfaces, see Build with AI in VS Code.
Choose where to chat
The interaction mechanics in this article apply to the Chat view, chat editor tabs, and the Agents window. Both the Chat view and the Agents window run agents. To choose between collaborating over code in your current workspace and coordinating work across projects, see Choose how you work.
For lightweight interactions, use inline chat to edit code or get terminal suggestions in place, or open Quick Chat for a temporary conversation.
Send a chat request
Type your message in the chat input box and press Enter or select the Send button. The agent can answer questions, analyze your code, run tools, make changes, and respond with a summary. You can then continue the conversation with follow-up messages. For example, you might ask an agent to make this change:
Add input validation to the signup form
For a hands-free conversation, start Voice Mode from the chat input. Voice Mode listens for follow-up requests and reads the agent's responses aloud. Voice Mode is experimental and might change or be removed.
To give extra project-specific context, you can add context to your prompt by referencing files, symbols, or other information with #-mentions.
For common tasks, you can use slash commands as shortcuts for frequently used prompts or to invoke agent skills. Type / in the chat input to see all available commands.
You can run multiple sessions in parallel and switch between them without losing context. Learn more in Manage agent sessions.
Each session has controls that shape how the agent responds: Session Target, Agent, Language model, and Permissions. Learn how to compare agent harnesses and select one for a session.
To get the best results, be specific about what you want, provide relevant context, and write clear instructions. For more information, see Get better responses.
Run terminal commands from chat
Start a message with ! to run a terminal command directly from the Chat view or Agents window. The ! must be the first character and must be followed by a command.
For example, enter the following message to run your tests:
!npm test
The command runs immediately in the session's default shell, without sending the message to the agent or asking for approval. It uses the session folder or worktree as the working directory. The command output and exit status appear in the chat transcript.
The ! command isn't available in Local harness sessions, cloud sessions, or extension-based agent integrations. Use the integrated terminal to run commands yourself instead.
Send messages while a request is running
You don't have to wait for a response to finish before sending your next message. While a request is in progress, the Send button changes to a dropdown that gives you three options for how to handle the new message.

- Add to Queue: your message waits and sends automatically after the current response completes. The current response finishes uninterrupted.
- Steer with Message: signals the current request to yield after finishing the current tool execution. The current response stops and your new message processes immediately. Use this to redirect the agent when it's heading in the wrong direction.
- Stop and Send: cancels the current request entirely and sends your new message right away.
Stopping a request doesn't undo file edits, terminal commands, or other actions that already completed. To restore affected workspace files and chat history, restore a checkpoint. Checkpoints don't reverse changes to external services.
For examples of when to steer or stop a request and how to write a focused correction, see Get an agent back on track.
The default action for the Send button is configurable. Use
chat.requestQueuing.defaultAction
to set it to steer (default) or queue.
Reorder pending messages
When you have multiple pending messages (queued or steering), you can drag and drop them to change the order in which they are processed. A drag handle appears on hover when more than one message of the same type is pending.

Add context to your prompts
Providing the right context helps the AI generate more relevant and accurate responses.
-
Implicit context: VS Code can include or suggest editor context, such as the active file or selection. The behavior depends on the interface, harness, and context settings. Attach important files explicitly instead of assuming that opening a file adds its contents to the request. Learn how implicit context works.
-
#-mentions: type#in the chat input to explicitly reference files (#file), folders, symbols, your codebase (#codebase), terminal output (#terminalSelection), or tools like#fetch. -
Vision: attach images, such as screenshots or UI mockups, as context for your prompt.
-
Browser elements: select elements from the integrated browser to add HTML, CSS, and screenshot context to your prompt.
Learn more about managing context for AI.
Generate and edit images (Experimental)
Generate illustrations, UI mockups, or other image assets directly in chat. In a Copilot harness session, the agent uses a dedicated image-generation model, separate from the language model selected for the conversation.
-
Verify that chat.copilot.imageGeneration.model is set to an image-generation model.
-
Ask the agent to generate an image. Describe the subject, style, and intended use. For example:
Generate a wide mountain landscape illustration for my app's welcome screen. Use muted colors and leave space for a heading on the left. -
Review the result and send a follow-up request to edit it:
Make it nighttime and add a few stars, keeping the space for the heading. -
Select Save next to the image in chat to download it to your device.
To edit an existing image, attach the image as context and describe the changes. You can also ask for multiple images, such as three variations of an illustration with different color palettes.
Image generation requires access to the image model and follows tool permission controls. Prompts and selected reference images are sent to the image model. Generation and editing use AI credits in addition to those used by the conversation model. Check the model setting for current rates, and expand an image-generation tool call to review its AI-credit usage, duration, and input and output usage.
To request a visible 'Made with AI' label on generated or edited images, turn on
chat.copilot.imageGeneration.watermark
. This setting defaults to false and applies to new and existing Copilot sessions without turning image generation on. The image model generates the label, so it isn't guaranteed. Turning the setting off doesn't remove existing labels from reference images.
To turn off image generation, set chat.copilot.imageGeneration.model to Off. This prevents future image-generation tool calls, but doesn't prevent the agent from creating SVGs or other graphics by writing code.
Image carousel
You can select images or videos in chat responses to open a dedicated carousel view. Media files from tool results (such as the integrated browser, Playwright, or other MCP servers) and inlined in assistant messages are all accessible from the carousel.

To disable the image carousel, set
imageCarousel.chat.enabled
to false.
Review and manage changes
After the AI changes files, review and validate the result before you commit or integrate it. In a Copilot harness session in the editor window, expand the working set Editor working set is experimental and might change or be removed. above the chat input to review tracked edits and use Keep or Undo. This works without Git, but doesn't list edits made through terminal commands. Keep clears pending review for edits that are already saved.
You can also select a changed file in a response to open its diff. In the Agents window, use the Changes panel instead of the editor working set. Review controls depend on the harness and interface.
For keyboard and screen reader access to a diff, use the Accessible Diff Viewer.
For harness-specific review controls, requesting revisions, restoring checkpoints, and integrating folder or worktree changes, see Review AI-generated code edits.
Get notified about chat responses
When you're working in another window or application, VS Code can send you OS notifications to let you know about important chat events, so you don't have to keep checking back.
Use chat.notifyWindowOnResponseReceived to configure when you receive an OS notification when a chat response is received. The notification includes a preview of the response, and selecting it brings focus to the chat session.
Use chat.notifyWindowOnConfirmation to configure when you receive an OS notification when the agent needs your input or confirmation to continue.
Both settings have three possible values:
off: never show notificationswindowNotFocused(default): show notifications only when the VS Code window is not focusedalways: show notifications even when the VS Code window is in focus
Set the value to always if you want to stay aware of chat activity while working in other parts of VS Code, such as when running long agent tasks in the background.
Find text in a chat session
Press ⌘F (Windows, Linux Ctrl+F) to search the entire conversation. Find is available in the Chat view, chat editor tabs, and the Agents window. It searches prompts and responses, including off-screen content and code blocks.
Use Enter and ⇧Enter (Windows, Linux Shift+Enter) to navigate between matches. When a match is inside a collapsed Completed N steps section, navigating to the match expands the section. Use the Match Case, Whole Word, and Regular Expression options to refine the results.
Find is not available in Quick Chat or inline chat. It does not search text inside tool pills or collapsed reasoning.
Navigate between prompts in a chat session
Use the following keyboard shortcuts to navigate between prompts in a chat session:
- ⌥⌘↑ (Windows, Linux Ctrl+Alt+Up): Go to the previous prompt in the chat session.
- ⌥⌘↓ (Windows, Linux Ctrl+Alt+Down): Go to the next prompt in the chat session.
- ⌥⌘PageUp (Windows, Linux Ctrl+Alt+PageUp): Go to the previous code block in the chat session.
- ⌥⌘PageDown (Windows, Linux Ctrl+Alt+PageDown): Go to the next code block in the chat session.
To inspect a chat response character by character or line by line with a keyboard or screen reader, run Open Accessible View (⌥F2 (Windows Alt+F2, Linux Shift+Alt+F2)). Learn more about the Accessible View.
Personalize chat
Adjust how chat content appears, add an interactive pet, or set a decorative background in the Agents window.
Customize the chat display
Use these settings to adjust the chat transcript:
| Display option | Settings |
|---|---|
| Markdown font | Set the font family with chat.fontFamily and the font size with chat.fontSize . |
| Code block font and layout | Set the font family, size, weight, and line height with chat.editor.fontFamily , chat.editor.fontSize , chat.editor.fontWeight , and chat.editor.lineHeight . Control line wrapping with chat.editor.wordWrap . |
| Sticky prompts | Use chat.stickyScroll.enabled to pin the current prompt to the top of the transcript while you scroll. |
| Request timestamps | Use chat.verbose to show or hide request and completion timestamps. Hover over a completion timestamp to view the elapsed response time. |
| Persistent progress (Experimental) | Use chat.experimental.persistentProgress to keep a progress indicator visible until an agent response finishes. Choose a colored or monochrome Draw animation, or turn the indicator off. |
With persistent progress, reasoning appears in separate collapsible previews and tool calls remain visible while they run. chat.experimental.persistentProgressVerbosity controls completed tool-call details. Compact replaces completed groups with expandable summaries when response text resumes or the response finishes. Verbose keeps the full details visible.
Persistent progress defaults to Draw in Insiders and Off in Stable.
For more chat preferences, see the AI settings reference.
Customize the Agents window chat background
Add a decorative background to the chat area of the Agents window without changing chat in the main VS Code window.
To set a background, run the Chat: Set Background... command from the Command Palette (⇧⌘P (Windows, Linux Ctrl+Shift+P)) or right-click an empty area of the chat. Then, choose one of these options:
- No Background: remove the background for the current color theme.
- Codicons: use a theme-aware pattern of built-in VS Code icons.
- Image...: select an image from your machine.
- Recently used: reuse one of your five most recent background images.
For an image background, run Chat: Change Background Layout... to repeat, stretch, center, or position the image along an edge or in a corner for the current color theme. Moving through the layout options previews each one. Select an option to save it, or dismiss the picker to restore the previous layout.
Light and dark color themes have separate backgrounds and image layouts. These choices are stored on the current machine and don't sync across devices.
Backgrounds are hidden in high contrast themes to preserve chat readability. The background commands are also unavailable while a high contrast theme is active.
Generate a chat background (Experimental)
Generate a background from a text description instead of finding an image yourself. Configure image generation and keep chat.agentSessions.appearanceTools.enabled turned on.
In a Copilot harness session in the Agents window, ask the agent to generate an image and apply it as your chat background. For example:
Generate a subtle mountain landscape and set it as my chat background.
If you don't specify colors, the agent uses your current theme as guidance and aims to keep chat messages readable. Explicit colors and design preferences in your prompt take precedence over the theme.
Image generation requires access to the selected model and uses AI credits in addition to those used by the conversation model. This workflow isn't available in the browser version of the Agents window.
Get better responses
Chat provides several ways to improve the quality and relevance of AI responses:
-
Write effective prompts: be specific about what you want, reference relevant files and symbols, and use
/commands for common tasks. Get inspired by prompt examples or review the full prompt engineering guide. -
Customize the AI: tailor the AI's behavior to your project by adding custom instructions, creating reusable prompt files, or building custom agents for specialized workflows. For example, create a "Code Reviewer" agent that provides feedback on code quality and adherence to your team's coding standards.
-
Extend with tools: connect MCP servers or install extensions that contribute tools to give the agent access to external services, databases, or APIs.
For more information, see Customize agent behavior in VS Code.
Troubleshoot chat interactions
Use Agent Logs and the Chat Debug view to inspect what happens when you send a prompt. Agent Logs shows a chronological event log of tool calls, LLM requests, and prompt file discovery. The Chat Debug view shows the raw system prompt, user prompt, context, and tool payloads for each interaction. These tools are useful for understanding why the AI responded in a certain way or for troubleshooting unexpected results.
Support
Support for GitHub Copilot Chat is provided by GitHub and can be reached at https://support.github.com.
To learn more about Copilot's security, privacy, compliance, and transparency, see the GitHub Copilot Trust Center FAQ.