How to use GitHub Copilot in vscode?
In VS Code, install the GitHub Copilot and Copilot Chat extensions, sign in with your GitHub account, then type to get gray inline suggestions you accept with Tab. Press Ctrl+I (Cmd+I on Mac) for inline chat, open the Chat view for questions, and switch to Agent mode to have Copilot edit multiple files toward a goal.
Why — the first-principles explanation
Using Copilot in VS Code means learning its three interaction modes, each suited to a different size of task. Once you know when to reach for which, the tool becomes second nature.
The first mode is inline completion — the everyday workhorse. As you type, Copilot streams gray 'ghost text' predicting your next lines. Tab accepts, Escape dismisses, and you can cycle alternative suggestions. This is best for finishing lines, writing repetitive blocks, and turning a comment into code. It requires nothing but typing.
The second mode is chat, for when you have a question or a focused request. Inline chat (Ctrl+I / Cmd+I) lets you highlight code and say 'add error handling' or 'explain this' right in the editor. The Chat view in the sidebar is a fuller conversation where you can ask about your project, generate tests, or debug. Chat is grounded in your open files, so its answers reference your actual code.
The third mode is Agent mode, for whole tasks. You describe a goal — 'add pagination to the users page' — and Copilot plans steps, edits multiple files, runs terminal commands, and iterates until it reaches a working state, pausing for your approval. It's less like autocomplete and more like delegating to a junior developer.
The throughline: start small with completions, escalate to chat when you need reasoning, and use agent mode when you'd otherwise assign the task to a teammate. In every mode, you review before committing — Copilot proposes, you decide.
An example that makes it click
Think of three ways to get help cooking. Inline completion is a sous-chef who hands you the next ingredient the moment you reach for it — fast and silent. Chat is asking that sous-chef a question mid-recipe: 'how do I fix this sauce?' And agent mode is stepping out of the kitchen and saying, 'make the whole dessert,' then coming back to taste-test what they made.
In VS Code you switch between these with a keystroke: type for the sous-chef's handoffs, press Ctrl+I to ask a question, or open the chat panel and flip to Agent mode to hand over the whole dish. You always taste before serving.
How to do it
- Open VS Code and go to the Extensions panel (Ctrl+Shift+X or Cmd+Shift+X).
- Search for and install 'GitHub Copilot' and 'GitHub Copilot Chat.'
- Click the Copilot icon and sign in with your GitHub account to authorize.
- Type code or a comment; when gray ghost text appears, press Tab to accept.
- Press Ctrl+I (Cmd+I on Mac) to open inline chat and give a focused instruction on selected code.
- Open the Chat view from the sidebar to ask questions, then switch the mode dropdown to Agent for multi-file tasks.
Key facts
- Copilot in VS Code needs two extensions: 'GitHub Copilot' and 'GitHub Copilot Chat.'
- Inline suggestions appear as gray ghost text; Tab accepts and Escape dismisses.
- Inline chat opens with Ctrl+I on Windows/Linux or Cmd+I on Mac.
- Agent mode can edit multiple files and run terminal commands to complete a described task.
- Chat responses are grounded in your open files and workspace context.
The AI pair-programmer built into your editor.
Affiliate link — we may earn a commission at no cost to you.▶ The 60-second explainer (script)
Here's how to use GitHub Copilot in VS Code. First, the setup: open the Extensions panel, install 'GitHub Copilot' and 'GitHub Copilot Chat,' then sign in with your GitHub account. Now you've got three ways to work. Number one, inline completion — the everyday mode. Just type, and Copilot shows gray ghost text predicting your next lines. Press Tab to accept, Escape to dismiss. Write a comment like 'sort by date' and it'll draft the code. Number two, chat. Highlight some code and press Control-I — or Command-I on a Mac — to give a quick instruction like 'add error handling.' Or open the Chat view in the sidebar for a full conversation about your project, grounded in your actual open files. Number three, agent mode. In the chat panel, switch the mode dropdown to Agent, describe a whole task like 'add pagination to the users page,' and Copilot will plan it, edit multiple files, run commands, and iterate — pausing for your approval. The rule of thumb: type for small stuff, chat when you need reasoning, and use agent mode when you'd normally hand the job to a teammate. And always review before you commit.
What authoritative sources say
People also ask
What extensions do I need in VS Code?
Install 'GitHub Copilot' for inline suggestions and 'GitHub Copilot Chat' for the chat and agent features, then sign in with GitHub.
How do I accept or reject a suggestion?
Press Tab to accept the gray ghost text or Escape to dismiss it. You can also cycle through alternative suggestions.
What is inline chat?
Press Ctrl+I (Cmd+I on Mac) to open a small chat over your selected code, then give a focused instruction like 'refactor this' or 'explain this.'
How do I use agent mode?
In the Chat view, switch the mode dropdown to Agent, describe a task, and Copilot will edit files and run commands to complete it, pausing for approval.