VSCode

How to Use Copilot in VS Code: Beginner’s Guide

How to Use Copilot in VS Code: Beginner’s Guide

To use Copilot in VS Code, hover over the Copilot icon in the Status Bar, select Use AI Features, and sign in with a GitHub account. If that account has no Copilot plan, it gets enrolled in Copilot Free automatically (VS Code documentation, 2026).

After sign-in, Copilot suggests code as dimmed ghost text while you type, and the chat panel runs in Ask, Plan or Agent mode.

The free tier does run out, though. GitHub’s plans documentation (2026) caps Copilot Free at 2,000 completions per month, and it’s the only plan where GitHub states a completion cap at all.

How to Set Up Copilot in VS Code

YouTube player

On a current build, setup is the Status Bar icon, Use AI Features, a sign-in method, and a browser window where you authorize VS Code. That’s all of it, per the VS Code documentation (page dated November 18, 2026).

Because Copilot is GitHub’s AI coding assistant, it runs on a GitHub account. An account that already has a Copilot plan gets picked up as is. An eligible account without one lands in Copilot Free when you sign in.

  1. Open VS Code and hover over the Copilot icon in the Status Bar.
  2. Select Use AI Features. If you signed in to GitHub in the editor earlier, the label may read Set up Copilot instead.
  3. Choose a sign-in method and follow the prompts.
  4. Authorize VS Code on GitHub, then return to the editor.
  5. Open a code file and start typing. Dimmed ghost text means Copilot is live.

A lot of older guides tell you to install two extensions, GitHub Copilot and GitHub Copilot Chat. You don’t need to anymore. Microsoft Learn says Copilot is already on with default settings, and there’s no extension to download manually.

One exception. If the Status Bar icon disappears after a VS Code update, look for GitHub Copilot Chat in the Extensions view.

The Status Bar isn’t the only way to sign in.

  • Run GitHub Copilot: Sign in from the Command Palette
  • Open the Accounts menu in the Activity Bar and pick Sign in with GitHub to use GitHub Copilot
  • On GitHub Enterprise, choose Continue with GHE.com, then enter your instance URL and credentials

Bring-your-own-key setups get you chat without a Copilot plan. They don’t replace Copilot for inline suggestions, though, and semantic search and embeddings still need it too.

If your employer gives you Copilot, sign in with that account rather than a personal one. It runs on the organization’s account and policies.

How to Get, Accept and Control Inline Suggestions

Type in a supported file and dimmed ghost text shows up at the cursor. Tab accepts it. Escape gets rid of it.

ActionKey or command
Accept a suggestionTab
Dismiss a suggestionEscape
Accept one line onlyCommand Palette: Accept Next Line Of Inline Suggestion
Force a suggestionCommand Palette: Trigger Inline Suggestion

Sometimes Copilot has more than one idea. Hover over the suggestion and its toolbar has next and previous controls for flipping between them.

To turn suggestions off for a specific language, use the Copilot menu in the Status Bar or the github.copilot.enable setting (* covers every language). I usually switch it off for Markdown. Ghost text in the middle of a sentence is just distracting.

Snooze is quicker when you only need quiet for a bit. Each use adds five minutes. On a metered connection, Copilot won’t start new automatic suggestions, but a manual trigger still works.

Does it actually make you faster? In a controlled experiment published in 2023 by researchers from Microsoft Research, GitHub and MIT Sloan, developers with Copilot finished a JavaScript HTTP server task 55.8% faster than the control group. That was one task in one language, so I’d read it as a best case and not a forecast for your week.

Generating Code From Comments

Comments steer what Copilot writes. Name the pattern you want, or list the methods a class should have, and it builds toward that.

Put a comment like “return false if the email has no @ or no dot” above an empty function. Now the suggestion has a concrete target instead of a guess.

Some habits that make suggestions noticeably better:

  • Descriptive names
  • Including the imports you plan to use up front
  • Keeping related files open, because Copilot reads open files as context
  • A small, correct example of the API sitting in an open file (delete it before it reaches production code)

Copilot will also happily repeat mistakes from the code around it. Check any API or dependency it proposes before accepting, and run the relevant tests afterward.

Next Edit Suggestions

After you change one thing, Copilot can propose related edits elsewhere in the file. Typo fixes, logic corrections, renames, matching a style you just used.

An arrow in the gutter marks the spot. Tab jumps to it and a second Tab accepts. Escape dismisses it. None of this shows up unless the github.copilot.nextEditSuggestions.enabled setting is on.

Vim extension users should update the extension first. Older versions clash with the Tab keybinding.

How to Open Copilot Chat and Ask Your First Question

Press Ctrl+Alt+I (Ctrl+Cmd+I on macOS) and the Chat view opens in the Secondary Side Bar. Type your question in plain language. Whatever file is open in the editor goes into the chat context automatically.

Which chat surface to use depends mostly on how big the question is.

Entry pointWindows/LinuxmacOSUse it for
Chat viewCtrl+Alt+ICtrl+Cmd+IQuestions about a file or project
Inline chatCtrl+ICmd+IA focused change to selected code
Quick ChatCtrl+Shift+Alt+LShift+Option+Cmd+LA one-off question, then back to work

If a shortcut does nothing, the Chat menu in the title bar has an Open Chat item. A separate walkthrough covers other ways to open the chat panel.

My rough rule is that a question about a selection goes to inline chat, and anything about a whole file or the project goes to the Chat view.

Right-clicking in the editor also brings up the common AI commands, like explaining or fixing code and generating tests.

Watch where the cursor is when you press Ctrl+I. In the editor it opens inline chat, in the terminal it opens terminal inline chat. If the wrong prompt box appears, click into the editor and try again.

Ask, Edit, Agent and Plan Mode: Which One to Use

Ask is for understanding code without changing it. Plan researches a complex change before anything gets written, and Agent is what you reach for to build a feature, fix a bug or create a project (VS Code documentation, November 2026). Go with the smallest mode that gets the job done.

ModeJobChanges files?
AskExplain code, answer questions, brainstormNo
PlanResearch a change and write an implementation planNot while planning, then hand off to Agent
AgentCarry out multi-step tasks on its ownYes, and it can run terminal commands
Edit (removed in VS Code 1.126)Controlled changes across several filesYes, confirmed with Keep

Why Older Guides Still Show Edit Mode

The VS Code feature reference lists Ask, Plan and Agent, plus custom agents. Edit mode was hidden by default in VS Code 1.110 (February 2026) and removed in VS Code 1.126 (June 2026). For the same kind of work, VS Code now recommends Agent mode, or a custom agent set up to mimic Edit.

Tutorials and Microsoft Learn modules written before then still teach Edit mode, which is where the confusion comes from.

GitHub announced Plan Mode on October 28, 2025. Still, open the mode dropdown in your own build. That list is the one that applies to you.

Here’s how I’d choose, using one running task (adding input validation) as the example.

  • One line inside a function is just an inline suggestion
  • Rewriting the whole function? Select it and use inline chat
  • Validation spread across a form, an API route and tests is Agent work
  • If you have no idea which files are involved, start in Plan and hand off to Agent

Cost is the practical reason to start small. Agent mode can make several model requests to complete a single task, according to Microsoft Learn, and GitHub’s documentation says each agent prompt consumes AI credits.

Agent edits code and runs terminal commands, and you approve each command with Continue. Read the command before you click. (Most people skip this at first. Don’t.)

You don’t have to attach context in Agent mode, since it analyzes the workspace by itself. For terminal-first work, GitHub Copilot CLI is the separate route.

How to Give Copilot Context With # Variables and Slash Commands

In the chat box, # attaches context and / runs a slash command. Per the VS Code documentation, # can pull in files, folders, symbols, your codebase, terminal output or tools.

The ones I end up using most:

  • #file points at a specific file
  • #codebase searches the whole project for relevant code
  • #terminalSelection brings in text you selected in the terminal
  • #fetch grabs a web page

The Add Context button in the Chat view does the same job. Search for a file by name, package.json for instance, and attach it.

With nothing attached, Copilot answers from the active file. So a vague answer usually means missing context. For questions about your entire codebase, add #codebase to the prompt. It searches the workspace for relevant code rather than loading every file into the model’s context.

Slash commandWhat it does
/explainExplains the selected code
/fixSuggests a fix
/testsGenerates tests
/docWrites documentation comments (from editor inline chat)
/planResearches and proposes an implementation plan

What Happened to @ Participants

You’ll still find @workspace and other @ participants in older tutorials. The VS Code documentation now says chat participants are deprecated and not supported in the Copilot harness, which is the default for new agent sessions.

#codebase is the documented way to point Copilot at your code for project-wide questions. @ participants still work only in the Local harness, and that one is deprecated too, with removal scheduled for February 2027.

How to Use Copilot for Everyday Coding Tasks

Most of a beginner’s week with Copilot is explaining unfamiliar code, fixing errors, generating tests and writing commit messages. Each has a built-in smart action, so you rarely need a full prompt.

TaskWhere to start
Explain codeRight-click in the editor and pick an AI command
Fix a compiler or lint errorThe lightbulb Code Action
Generate testsSelect code, then Generate Code > Generate Tests
Fix a failing testFix Test Failure in Test Explorer
Write a commit messageThe sparkle action

Fixing an error usually goes like this.

  1. Select the function that throws the error.
  2. Open inline chat and describe the problem in one line, or use the lightbulb on the error itself.
  3. Read the proposed change before you accept it.
  4. Accept it, then run the tests that touch that function.

The lightbulb shows up for compiler errors and linting warnings alike, so one habit handles both.

With tests, Copilot writes the first draft and you decide whether it’s any good. A unit test that only asserts what the code does today proves nothing. Check that each assertion states what the code should do.

Before you commit, the code review smart actions can give selected code a second pass.

What Copilot Costs and How to Pick a Model

Copilot Free costs nothing and Copilot Pro costs $10 per month. Individual plans now meter usage in AI credits instead of premium requests, and how many credits a request burns depends on the model and the tokens processed.

The free tier numbers are a bit messy. GitHub’s December 2024 launch post gave Free 2,000 code completions and 50 chat messages per month. The current plans page keeps the 2,000 completion cap but lists no numeric chat limit, and the credit allowance isn’t stated.

Plan figures change often, so confirm them on the GitHub plans page before you decide anything.

From the GitHub plans page, retrieved November 2026:

  • Copilot Free: 2,000 completions per month, the only plan with a stated completion cap
  • Copilot Pro: $10 per month, 1,500 AI credits (1,000 base plus 500 flex)
  • Copilot Pro+: $39 per month, 7,000 AI credits (3,900 base plus 3,100 flex)
  • Copilot Max: $100 per month, 20,000 AI credits (10,000 base plus 10,000 flex)
  • Auto model selection gets a 10% discount on model costs on paid plans

I’d stay on Free until the allowance actually runs out. Free users who hit the limit can upgrade from inside VS Code or wait until the next month.

Choosing a Model

Leave the picker on Auto unless a task proves it needs more. Auto model selection became generally available in VS Code for all Copilot plans on December 10, 2025, and a May 2026 update made it route each request to the best model for the task.

On Free there isn’t much to decide. The plans page lists auto model selection only, so the manual picker is a paid-plan thing.

On a paid plan, the language model picker in the chat input field changes the model for chat and code editing. Save reasoning models for complex refactoring and multi-step debugging, plus the occasional architectural decision.

Thinking effort affects cost as well. Higher effort produces more thinking tokens and increases AI credit consumption.

Tracking Credit Use

Counting messages won’t tell you much. Consumption depends on the model’s rates and the tokens processed, not only the number of messages you send.

  • Open the Copilot status dashboard from the Status Bar to see the share of your monthly allowance used
  • Check usage per chat request and per session
  • Start Agent tasks small, because they run many model calls

How to Customize Copilot With Instructions and Tools

Put a file at .github/copilot-instructions.md in the workspace root and Copilot reads it as always-on guidance for the project. Don’t want to write it from zero? The /init slash command analyzes your workspace and generates a starter file tailored to your language, framework and structure.

Custom Instructions

Instructions can live in different files, and each one has a different reach.

  • copilot-instructions.md carries coding style and naming conventions for the whole project
  • AGENTS.md is an accepted alternative project instructions file for Copilot
  • .instructions.md files get attached by VS Code automatically when their applyTo pattern matches a file being changed

Keep rules short and checkable. “Use camelCase for variables” works. “Write clean code” does nothing.

Commit message style has its own setting, github.copilot.chat.commitMessageGeneration.instructions, so the project-wide file doesn’t need to carry it.

And instructions guide the output. They don’t enforce it, so review still applies.

MCP Servers

Add an MCP server when your agent needs something its existing tools can’t do, such as querying a database. MCP (Model Context Protocol) is the open standard behind this, for connecting AI models to external tools and services.

Run MCP: Add Server from the Command Palette to start the guided flow. VS Code asks you to confirm that you trust the server before it starts.

Take that prompt seriously. Local MCP servers can run code on your machine, and their tools can reach services with your permissions. Check the publisher, the launch command and the requested access first.

Honestly, skip MCP in your first week. Instructions and the built-in tools cover almost everything a beginner needs.

Why Copilot Stops Working, and When to Turn It Off

When Copilot breaks, it’s usually a blocked network or an excluded file. A used-up allowance and an out-of-date editor account for most of the rest. The table maps each symptom to the first thing to try.

SymptomLikely causeFirst fix
Cannot connect or sign inFirewall, proxy or VPNRun GitHub Copilot: Collect Diagnostics
No suggestions in one fileA content exclusion settingAsk whoever manages the Copilot policy
Slow responsesHigh CPU or memory load, or a proxy interferingCheck system load, then proxy and VPN settings
Features stop mid-monthMonthly allowance used upCheck the status dashboard, then wait or upgrade

Update VS Code before you dig into logs. Run Code: Check for Updates from the Command Palette first.

Proxies are the sneaky one. Copilot uses custom code to connect to proxies, so a proxy setup your editor supports is not necessarily supported by Copilot. A working browser proves nothing here.

When Copilot Is the Wrong Tool

If you’re still learning to code, Copilot can get in the way. GitHub’s own learning guide starts by disabling inline suggestions, then adds instructions that make chat act like a tutor, so you still write the code yourself.

Work code is a different concern. Review the GitHub Copilot Trust Center and your organization’s policies before sending any of it.

The chat.disableAIFeatures setting hides chat and inline suggestions and disables the Copilot extensions, at user or workspace level. A separate walkthrough on disabling Copilot in VS Code covers the other routes.

GitHub Copilot in VS Code FAQ

Is GitHub Copilot free for students?

Yes, for verified students. Copilot Student includes a monthly allowance of AI credits, but it offers auto model selection only and excludes third-party agents (GitHub plans documentation, 2026).

Verified teachers and popular open source maintainers can qualify for free Copilot Pro.

Does Copilot collect telemetry, and can I turn it off?

By default, VS Code sends usage telemetry. Setting telemetry.telemetryLevel to off stops it. The VS Code documentation notes that this setting is separate from how the AI provider handles your data, so review your Copilot settings on github.com too.

Suggestions that match public code are allowed by default. You can change that in Copilot Settings on github.com.

How do I switch to a different GitHub account for Copilot?

Sign out from the Accounts menu in the Activity Bar, then sign back in with the other account.

Want a separate account per workspace or profile? Go to Accounts, Manage Extension Account Preferences, GitHub Copilot Chat.

Can I use VS Code without signing in to Copilot?

Yes. VS Code keeps working without a sign-in if you don’t want AI.

If you hide the built-in AI features, that choice is respected after you update to a new version of VS Code.

Can I use Claude or Codex in VS Code instead of Copilot?

Yes. VS Code supports Claude and Codex harness setups, though they’re disabled when Copilot enterprise-managed settings apply.

Each route has its own sign-in and billing. The walkthrough on working with Claude in VS Code covers the first one, and the Codex setup in VS Code has its own guide.

How to Review What Copilot Writes Before You Accept It

I review Copilot in VS Code output by risk, with Agent changes first, tests second, single suggestions last. The changes that touch the most files get the closest read.

  • Agent diffs across files
  • Tests after every accepted change
  • APIs and dependencies in ghost text

It does cost time. A Tab press takes a second and a diff review doesn’t, so spend the slow review where one mistake can spread, not on every line of ghost text.

This falls apart once an Agent task grows past what you can read in one sitting. Split the task with Plan mode at that point and review each piece on its own.

Everything here matches the VS Code documentation as checked on November 20, 2026. If your build’s Agent mode stops asking for approval before it runs terminal commands, move command review ahead of diff review.

For a second reader on the same diff, try AI-powered code review tools.

Bogdan Sandu

Stay sharp. Ship better code.

Every week: one curated article, one tool worth knowing, one tip you can use tomorrow. No noise, no padding.