How to Use GitHub Copilot in VS Code: A Beginner's Guide
Set up GitHub Copilot in VS Code, accept inline suggestions, use chat, give better context, review the output carefully and adjust your privacy settings.

Before you start
- Visual Studio Code installed and up to date
- A GitHub account with access to a Copilot plan (GitHub offers a free tier as well as paid plans)
- A project in a language you know well, so you can judge the suggestions
This guide walks you through installing GitHub Copilot in Visual Studio Code, signing in, and using its two main features: inline code suggestions as you type, and a chat panel for questions, explanations and larger edits. You will also learn how to give Copilot better context, how to review what it produces, how to use it to write tests, and which settings control privacy and where suggestions appear.
Step 1: Install the extension and sign in
- Open the Extensions view in VS Code (
Ctrl+Shift+Xon Windows and Linux,Cmd+Shift+Xon macOS). - Search for GitHub Copilot, check that the publisher is GitHub, and install it. Recent versions of VS Code may instead offer a Copilot setup prompt that installs everything you need in one step; either route works.
- When prompted, sign in with your GitHub account and authorize VS Code in the browser window that opens.
- Confirm Copilot is active: its icon appears in the status bar, and clicking it shows the current status and quick settings.
Step 2: Accept and steer inline suggestions
As you type, Copilot shows suggestions as dimmed "ghost text" after your cursor. A suggestion can be a single line or a whole function.
- Press Tab to accept a suggestion.
- Press Esc to dismiss it, or simply keep typing.
- Press Alt+] or Alt+[ (Option+] or Option+[ on macOS) to cycle through alternatives when more than one is available.
- Hover over a suggestion to see a small toolbar with the same options.
Suggestions are shaped by the code around your cursor and by other open files. The quickest way to improve them is to state your intent clearly before you start typing the implementation:
// Parse a duration string such as "1h30m" or "45s" into total seconds.
// Supported units: h, m, s. Return null for empty or invalid input.
export function parseDuration(input: string): number | null {Step 3: Use the chat panel
Open the Chat view from the Copilot icon in VS Code, or search for "chat" in the Command Palette to find it and its keyboard shortcut. For a quick edit in place, select some code and press Ctrl+I (Cmd+I on macOS) to open inline chat.
- Ask questions about your code: select a function and ask what it does or why it might fail.
- Use slash commands such as
/explain,/fixand/tests. Type/in the chat box to see what your version supports. - Add context by attaching files or symbols. Type
#to see the references available, so answers are based on your code rather than generic examples. - Request multi-file changes using the chat's editing or agent modes, then review each proposed change before keeping it.
The principles in our guide to writing effective AI prompts apply here too: say what you want, give constraints, and show an example of the style you expect.
Step 4: Review every suggestion
Copilot's output is often correct and sometimes subtly wrong. It can call functions that do not exist, use outdated APIs, miss edge cases, or introduce security problems such as unvalidated input. You remain responsible for every line you commit.
- Read each suggestion in full before accepting it. Avoid accepting long blocks you have only skimmed.
- Check that library functions and parameters exist in the version your project actually uses.
- Run the code, your linter and your existing tests.
- Look closely at authentication, input validation, database queries, file paths and anything involving secrets.
- For larger changes, review the diff in source control before committing.
Step 5: Use Copilot to write tests
Tests are one of the most productive uses of Copilot, because the expected behavior is usually clear and the output is easy to verify.
- Open the file under test and an existing test file, so Copilot can see your testing framework and conventions.
- Ask chat to generate tests for a selected function, or use
/tests, and list the edge cases you care about, such as empty input, invalid formats and boundary values. - Run the tests. Then deliberately break the function to confirm at least one test fails; a test that can never fail proves nothing.
- Delete tests that merely restate the implementation and keep the ones that check real behavior.
Step 6: Adjust privacy and editor settings
Review two sets of settings: your Copilot settings on GitHub, which cover policies such as public code matching and, on individual plans, data-sharing preferences; and your VS Code settings, which control where suggestions appear. To turn inline suggestions off for specific languages, add an entry like this to your user settings.json:
{
"github.copilot.enable": {
"*": true,
"markdown": false,
"plaintext": false
}
}Troubleshooting and next steps
- No suggestions appear. Check the status bar icon for sign-in or plan messages, confirm Copilot is enabled for the current language, and check whether you have reached a usage limit.
- Sign-in fails or loops. Sign out of GitHub from the Accounts menu in VS Code and sign in again. On corporate networks, proxy settings may need configuring.
- Suggestions are irrelevant. Add a comment describing what you want and open the related files.
Use Copilot daily for a week on low-risk work such as boilerplate, tests and documentation comments before relying on it for core logic. Notice where it saves time and where you spend longer fixing its output than writing the code yourself. To compare it with an editor built around AI, see our profiles of GitHub Copilot and Cursor.
- #GitHub Copilot
- #VS Code
- #AI coding
- #Developer tools
WebAIAutomation Research Desk
Research & Analysis
The research desk tracks the AI and automation landscape, compares products side by side and explains the technology behind them.
More guides

How to Self-Host n8n with Docker and Docker Compose
Run n8n on your own server with the official Docker image: a quick docker run test, a Compose setup, HTTPS behind a reverse proxy, backups and updates.

How to Write Effective AI Prompts: A Practical Framework
Learn a repeatable prompt structure (role, context, task, format and constraints) plus a simple iteration loop for getting useful answers from AI tools.

How to Automate Email Follow-Ups with Zapier and AI
Build a Zapier workflow that sends a personalized follow-up email when a form is submitted or a row is added, with an optional AI step to draft the text.
Newsletter
Stay ahead of AI and automation
A concise weekly brief with new tools worth trying, practical workflows and the technology shifts that matter.