Copilot Chat

Copilot Chat

Copilot Chat is the conversation interface built into your editor. While inline completion is optimized for speed and small suggestions, Chat is for deeper work: understanding code, debugging, refactoring, and generating larger blocks with precise control over what the AI sees.

Opening Chat

  • VS Code: Ctrl + Cmd + I (macOS) or Ctrl + Alt + I (Windows/Linux), or click the chat icon in the sidebar.
  • JetBrains: Tools → GitHub Copilot → Open GitHub Copilot Chat, or the chat icon in the tool window bar.

The Chat panel docks to the side of your editor. You can resize it or float it as a separate window.

Inline Chat (editing in place)

In addition to the side panel, VS Code has Inline Chat: press Cmd + I (macOS) or Ctrl + I (Windows/Linux) while your cursor is in the editor. This opens a small input box directly in the code. Type your request and the AI suggests changes in-place with a diff you can accept or reject. Use this for targeted edits:

  • "Add null check before using this variable"
  • "Rename data to userData throughout this function"
  • "Add JSDoc comment to this function"
  • "Convert this callback to async/await"

Inline Chat is faster than opening the side panel when the task is small and clearly scoped.

Attaching context: the key skill

Chat is only as good as the context you give it. Always think: "What does the AI need to see to answer this well?"

@workspace – Searches the entire project for relevant code. Use when you do not know which file the AI needs to see, or when asking broad questions about the project.

#file:path/to/file.ts – Attaches a specific file. Use when asking about a particular module or when you want the AI to follow patterns from a specific file.

Selected text – Select code in the editor, then open Chat. The selection is automatically included. The most common workflow: select a function, open Chat, ask "Explain this" or "Refactor this".

@terminal – Attaches the terminal output. Use when debugging a runtime error: open Chat, type @terminal to include the last terminal output, then ask "What does this error mean?"

#editor – Attaches the currently visible code in the editor.

Chat commands (slash commands)

Type / in the Chat input to see available commands. The most useful:

/explain – Explain the selected code or attached file. "What does this function do? What are the edge cases?"

/fix – Fix a bug in the selected code. Paste the error message alongside it for best results.

/tests – Generate tests for the selected function. Specify what to test:

code
/tests write unit tests covering normal case, empty input, and invalid input

/doc – Generate documentation for the selected function or file.

/simplify – Suggest a simpler version of the selected code.

A real debugging session

This is how a Chat debugging session looks in practice.

You have a function that is throwing:

code
TypeError: Cannot read properties of undefined (reading 'email') at processNotification (notifications.ts:45)

Step 1: Select the processNotification function in the editor.

Step 2: Open Chat. Type:

code
This function is throwing "Cannot read properties of undefined (reading 'email')" at line 45. The error only happens when processing certain notifications, not all. What is the likely cause and how should I fix it?

Step 3: The AI reads the function (from your selection) and the error (from your message) and explains: "Line 45 accesses notification.user.email but notification.user can be null if the notification was created without a linked user. Add a null check."

Step 4: Ask: "Show me the corrected version with the null check." Apply the suggestion.

Step 5: "Write a test case that would have caught this bug." Apply the test.

That entire workflow takes about three minutes.

When to use Chat vs inline completion

TaskUse
Complete obvious next lineInline
Write a well-defined functionInline (with comment)
Explain how something worksChat
Debug a runtime errorChat
Refactor a functionChat (inline chat for small, side panel for larger)
Generate testsChat (/tests)
Generate docsChat (/doc)
Large feature touching multiple filesWorkspace / Copilot Workspace