🚀 Get in VS Code!

Use chat in VS Code

Use chat in Visual Studio Code to ask about your codebase or make edits across your project by using natural language. Chat can operate in different modes, optimized for your use case, from asking questions to making multi-file edits or starting an agentic coding workflow.

You might want to use chat in VS Code when you need to:

  • Understand code - "Explain how this authentication middleware works"
  • Debug issues - "Why am I getting a null reference in this loop?"
  • Get code suggestions - "Show me how to implement a binary search tree in Python"
  • Optimize performance - "Help me improve the efficiency of this database query"
  • Learn best practices - "What's the recommended way to handle errors in async functions?"
  • Get VS Code tips - "How do I customize keyboard shortcuts?"
Tip

If you don't yet have a Copilot subscription, you can use Copilot for free by signing up for the Copilot Free plan and get a monthly limit of completions and chat interactions.

Chat mode

Based on your specific needs, you can choose between different modes of chat:

Mode Description Scenario
Ask Ask questions about your codebase or technology concepts. Understand how a piece of code works, brainstorm software design ideas, or explore new technologies.
Edit Make edits across multiple files in your codebase. Apply code edits directly in your project for implementing a new feature, fixing a bug, or refactoring code.
Agent Start an agentic coding workflow. Autonomously implement high-level requirements for a new feature or project with minimal guidance, invoking tools for specialized tasks, iterating to resolve issues as they occur.

Switch between the different chat modes by using the Mode dropdown in the Chat view.

Screenshot showing the Copilot Chat view, highlighting the mode dropdown.

Access chat in VS Code

You can access chat in VS Code in several ways:

  • Chat view (⌃⌘I (Windows, Linux Ctrl+Alt+I)): have an ongoing, multi-turn chat conversation in a dedicated view. Switch between different chat modes at any time. By default, the Chat view is located in the Secondary Side Bar in VS Code.

  • Inline chat (⌘I (Windows, Linux Ctrl+I)): start a chat conversation directly from the editor (editor inline chat) or integrated terminal (terminal inline chat) to get suggestions in-place.

  • Quick Chat (): ask a quick question and get back into what you were doing.

Quickly access chat by using the corresponding keyboard shortcuts or via the Copilot menu in the VS Code title bar.

Screenshot of the Copilot Chat menu in the VS Code Command Center

Submit a chat prompt

You can use natural language to make chat requests. You can ask questions about your codebase, get code suggestions, or brainstorm ideas.

Open the Chat view (⌃⌘I (Windows, Linux Ctrl+Alt+I)) and enter your prompt in the chat input field. Notice that the response might rich content such as Markdown text, code blocks, buttons, file trees, and more.

Copilot Chat view in the Secondary Side Bar and Explorer view in the Primary Side Bar.

Here are some example prompts you can experiment with:

  • Ask questions about coding and technology concepts ("What is a linked list?", "top 10 popular web frameworks")
  • Brainstorm ideas on how to best solve a coding problem ("How to add auth to my project?")
  • Explain a block of code ("@workspace /explain", "What does this code do?")
  • Propose code fixes ("@workspace /fix", "This method gives a FileNotFoundException")
  • Generate unit test cases or code documentation ("@workspace /tests", "@workspace /doc")
  • Ask about VS Code settings (@vscode how do I disable the minimap?)

For more prompt examples, see the Copilot Chat Cookbook in the GitHub documentation.

Tip

Type /help in the chat input field to get help about GitHub Copilot and how to interact with Copilot Chat.

Open a chat session in the editor

You can open a chat session as a separate editor tab, or even as a separate window. As a side effect, this enables you to have multiple chat sessions open at the same time.

To open a chat session in the editor or a separate window:

  1. Select the ... icon in the top-right corner of the Chat view.

    Screenshot of the Chat view, highlighting the three-dot menu that contains the Open in Editor and Open in New Window options.

  2. Select Open Chat in Editor or Open Chat in New Window.

Change the language model

Copilot offers different built-in language models to choose from. Some models are optimized for fast coding tasks, while others are better suited for slower planning and reasoning tasks. Use the model picker in the chat input field to change the model that Copilot uses for generating a response.

Screenshot of the Copilot Chat model picker

You can also add models from other model providers (preview) and use them in chat. Get more details about how to use models from other providers.

Note

The list of available models might vary based on your Copilot subscription and might change over time. See the GitHub Copilot documentation for more information about the available language models.

Reference tools in chat

You can directly reference an agent mode tool in your prompt by typing # followed by the tool name. You can do this in all chat modes (ask, edit, and agent mode).

Add chat context

Copilot tries to determine the intent and scope of your question based on your natural language chat prompt. To help get more relevant responses, provide additional context in your chat prompt. For example, add files, test results, terminal output, or other types of context that might be relevant to your question.

Screenshot of the Copilot Chat view with the context menu open

Get more details about adding context to your chat prompt.

Tip

Let Copilot find the right files automatically by adding #codebase in your prompt. Make sure to enable the github.copilot.chat.codesearch.enabled (preview) setting to get the best results.

Vision (Preview)

Chat supports vision capabilities, which means you can attach an image as context to your chat prompt and ask questions about it. For example, attach a screenshot of a block of code and ask to explain it, or attach a sketch of a UI and ask agent mode to implement it.

Tip

You can drag and drop an image from a web browser onto the Chat view to add it as context.

Chat history

The Chat view is designed to be a multi-turn conversation. Copilot uses the history of the conversation as context to your current prompt. This means that you can ask follow-up questions or clarify your previous question without having to repeat the context.

At any time, you can create a new chat session by using the New Chat (+) button (⌃L (Windows, Linux Ctrl+L)) in the Chat view. This can be useful if you want to move to a different topic and avoid the previous context and history.

You can access the previous chat sessions by using the Show Chats... button in the Chat view or by using the Chat: Show Chats... command in the Command Palette. Select an entry to open that chat session in the Chat view.

Screenshot of the Chat view with the Show Chats... button highlighted

You can export all prompts and responses for a chat session in a JSON file with the Chat: Export Chat... command in the Command Palette.

Revert previous requests

Within a chat session, you can remove a specific prompt and the corresponding response from the conversation history of that session. Hover over the prompt and select the x control. Removing a request might be useful if you notice that the language model is not providing relevant responses or is taking an unwanted direction.

Chat view with multiple prompts, highlighting the 'x' control to delete a chat prompt and response.

Use voice interactions

With the voice control capabilities in VS Code, provided by the VS Code Speech extension, you can initiate a chat conversation by using your voice:

  • Use your voice to dictate your chat prompt
  • Use the "Hey Code" voice command to start a voice session with Copilot Chat
  • Accelerate voice input for chat by using the "hold to speak" mode

Learn more about how to use voice interactions in VS Code.

Privacy and transparency

To enable more workspace search features for private repositories, we require additional permissions. If we detect that we don't have these permissions already, we will ask for them at startup. Once granted, we'll securely store the session for the future.

Modal window asking for additional authentication for a private repository.

Learn more about security, privacy, and transparency in the GitHub Copilot Trust Center.

Frequently asked questions

How do I choose between the different chat modes?

The different chat modes are optimized for different use cases:

  • Use editor inline chat to ask questions or make edits directly in the active editor. This is useful for making code changes or asking questions that are scoped to the active file.

  • Use ask mode to ask questions about your codebase or technology concepts. The response might include code suggestions, which you can apply manually and individually to your codebase. Changes are not automatically applied to your codebase.

  • Use edit mode to directly apply edits across multiple files in your codebase based on your chat prompt. You provide the relevant context and files for your prompt.

  • Use agent mode to start an agentic coding workflow, whereby Copilot autonomously determines the relevant context and files, determines which tasks need to be performed to complete the request. It then iterates independently to achieve the desired outcome, fixing issues as they come up. Agent mode can invoke tools to perform specialized tasks, such as running terminal commands, validating test cases, or accessing APIs.

Additional resources

You can read more about GitHub Copilot and how to use it in VS Code in the GitHub Copilot documentation.

Or check out the VS Code Copilot Series on YouTube, where you can find more introductory content and programming-specific videos for using Copilot with Python, C#, Java, PowerShell, C++, and more.

Next steps