is now available! Read about the new features and fixes from September.

Inline chat

With Copilot inline chat in Visual Studio Code, you can ask questions and get suggestions directly in the editor or get help with shell commands within the integrated terminal. Inline chat allows you to stay in the flow of your work without having to switch to a separate Chat view.

Prerequisites

Use editor inline chat

When you use editor inline chat, your prompt is scoped to the code in the active editor. Inline chat might use the content from other files in your workspace as context for your prompt.

To use editor inline chat:

  1. Open a file in the editor.

  2. Open editor inline chat by using the ⌘I (Windows, Linux Ctrl+I) keyboard shortcut or by selecting Open Inline Chat from the Chat menu in the title bar.

  3. Type your prompt in the chat input field and press Enter.

    Tip

    Select a block of code in the editor to scope the prompt to that code.

  4. VS Code shows a diff with the code suggestion inline in the editor. Accept or reject the changes.

    Screenshot of editor inline chat asking to not use recursion for a factorial function.

  5. Optionally, ask a follow-up question to get other suggestions or refine the results.

Tip

Attach context to your inline chat prompt to include relevant files, code symbols, or other context. Learn more about adding context to your chat prompt.

Use terminal inline chat

You can bring up terminal inline chat in the integrated terminal to get help with shell commands or ask terminal-related questions.

To use terminal inline chat:

  1. Open the terminal in VS Code by selecting the View > Terminal menu item or using the ⌃` (Windows, Linux Ctrl+`) keyboard shortcut.

  2. Start terminal inline chat by using the ⌘I (Windows, Linux Ctrl+I) keyboard shortcut or running the Terminal Inline Chat command in the Command Palette.

  3. Type your prompt in the chat input field and press Enter.

    Screenshot showing that you can ask complex questions like "list the top 5 largest files in the src dir"

  4. Review the response and select the Run (⌘Enter (Windows, Linux Ctrl+Enter)) to run the command in the terminal

    Alternatively, select Insert (⌥Enter (Windows, Linux Alt+Enter)) to insert the command into the terminal and modify it before running.