AI now writes nearly half of the code developers ship. That number keeps climbing.
Knowing how to use GitHub Copilot in VS Code has quietly become one of the most practical skills a developer can have in 2025. Over 20 million developers already use it. The ones getting the most out of it aren’t just accepting ghost text suggestions – they’re using Copilot Chat, slash commands, and context variables to speed up entire workflows.
This guide covers everything: installation, inline code completion, Copilot Chat, prompt writing, plan differences, and how to fix the issues that actually come up.
No fluff. Just what works.
What Is GitHub Copilot in VS Code
GitHub Copilot is an AI coding assistant built directly into VS Code as an official extension. It offers two distinct surfaces: inline code completion (ghost text that appears as you type) and Copilot Chat (a conversational sidebar for broader questions and commands).
Copilot runs on large language models trained on public code from GitHub, including OpenAI Codex and successor architectures. It doesn’t just autocomplete variable names – it can suggest entire functions, generate unit tests, explain unfamiliar code, and write documentation, all without leaving the editor.
As of July 2025, over 20 million developers use Copilot, with 90% of Fortune 100 companies having deployed it in production workflows (Microsoft, 2025). That’s not a niche tool anymore. It’s becoming standard infrastructure for software development teams.
One thing worth knowing upfront: Copilot and Copilot Chat are technically two separate extensions in the VS Code Marketplace, though they’re designed to work together. Copilot handles inline suggestions. Copilot Chat handles the conversational interface, slash commands, and context-aware queries.
| Feature | Copilot (Inline) | Copilot Chat |
|---|---|---|
| Trigger | As you type | Manual prompt |
| Interface | Ghost text in editor | Sidebar or inline (Ctrl + I) |
| Best for | Code completion, boilerplate | Explanations, refactoring, tests |
| Context scope | Current file + open tabs | @workspace, @terminal, #file |
Copilot works across most popular languages. It’s notably strong in Python, JavaScript, TypeScript, Go, Ruby, C#, and C++. Performance does vary by language – Java developers, for instance, see up to 61% of their code generated by Copilot, compared to lower rates in less common languages.
Access requires a GitHub account tied to an active Copilot plan. GitHub introduced a Free plan in late 2024 with monthly limits on completions and chat interactions – enough to evaluate the tool, though not really enough for daily professional use.
Installing and Setting Up GitHub Copilot in VS Code

Getting Copilot running is fast. 81% of developers who gain access install the VS Code extension the same day, and 96% start accepting suggestions immediately (GitHub, 2025). The setup process supports that speed – it genuinely takes under five minutes.
Install the Extensions
Two extensions to install, not one:
- GitHub Copilot – handles inline code suggestions and ghost text
- GitHub Copilot Chat – adds the sidebar chat panel, slash commands, and inline chat (Ctrl+I)
Open the VS Code Extensions view with Ctrl+Shift+X, search “GitHub Copilot,” and install both. Alternatively, hover over the Copilot icon in the bottom status bar and select Set up Copilot – VS Code will guide you through both installs.
Copilot Chat releases in lockstep with VS Code, so always keep both VS Code and the extension on the latest version. Running an older VS Code build is one of the more common reasons Copilot Chat stops working correctly.
Sign In and Activate
After installing, VS Code prompts you to sign in with a GitHub account. Click the Copilot icon in the status bar, choose a sign-in method, and complete the browser authorization flow.
Key things to confirm after setup:
- Status bar shows the Copilot icon without a warning indicator
- Status reads “Ready” when you hover over the icon
- Ghost text appears when you open a supported file and start typing
If you have a Copilot subscription through an organization or GitHub Enterprise, sign in with those credentials instead. You can even link separate GitHub accounts per workspace – useful if you use different Copilot plans for work and personal projects.
No Copilot subscription yet? VS Code will automatically enroll you in the Copilot Free plan during sign-in. You get a monthly cap on inline suggestions and chat messages, which is enough to properly test it before committing to a paid plan.
How GitHub Copilot Inline Suggestions Work

Open any file in a supported language and start typing. Copilot generates ghost text – dimmed suggestions that appear at your cursor position – within milliseconds.
Press Tab to accept. Press Escape to dismiss. Use Alt+] and Alt+</code> to cycle through alternative suggestions if the first one isn’t quite right.
How Copilot Reads Context
Copilot doesn’t just look at the current line. It reads:
- The full current file, including imports, function signatures, and comments
- Other files currently open in VS Code tabs
- Your cursor position and surrounding code block
This is why keeping related files open matters. If you’re working on a service file, having the corresponding model or interface file open in another tab gives Copilot more context and tends to produce better suggestions. Context window limitations mean Copilot doesn’t automatically scan your entire [codebase – what’s open is what it sees.
Ghost Text vs. Next Edit Suggestions
Ghost text is the classic completion mode – Copilot predicts what comes next at your cursor.
Next Edit Suggestions (NES) is a newer addition. Rather than just completing forward from the cursor, NES predicts where your next edit will be, even if it’s elsewhere in the file. An arrow appears in the gutter indicating a suggested edit. Press Tab to navigate to it and accept.
NES is particularly useful during refactoring. If you rename a function, Copilot can predict that you’ll also need to update its call sites and suggest those edits proactively. It’s not perfect, but it noticeably reduces the back-and-forth of tracking down all the places a change needs to propagate.
| Mode | Trigger | Best use case | Accept shortcut |
|---|---|---|---|
| Ghost text | Typing in editor | Writing new code, boilerplate | Tab |
| Next Edit Suggestions | Ongoing edits | Refactoring, propagating changes | Tab (use gutter arrows to cycle) |
| Inline Chat | Ctrl + I | Targeted changes without sidebar | Accept in-place diff |
Developers using Copilot completed coding tasks 55% faster in controlled tests with Accenture across 4,800 developers (GitHub/Accenture, 2024). For new team members joining an unfamiliar codebase, that speed gain jumps to around 25% just from navigating and understanding existing code faster.
Using Copilot Chat in VS Code
Copilot Chat is a separate interaction mode from inline suggestions. It’s closer to a conversational assistant – you ask it things, it responds with code, explanations, or structured output. By April 2025, Copilot Chat had already auto-reviewed over 8 million pull requests in enterprise deployments (GitHub, 2025).
Opening Copilot Chat
Three ways to open it:
Ctrl+Alt+I(Windows/Linux) orCtrl+Cmd+I(Mac) – opens the full sidebar chat- Click the chat icon in the VS Code title bar
Ctrl+I– opens inline chat directly in the editor, without switching panels
Inline chat (Ctrl+I) is the one I’d recommend learning first. It keeps you in the file, shows suggested edits as a diff, and lets you accept or discard without breaking flow. Perfect for quick refactors or generating a test for a specific function.
Context Variables: @workspace, @terminal, @vscode
These @ mentions tell Copilot Chat which domain to draw context from:
- @workspace – queries your entire project, not just the open file. Use this for architecture questions or finding where something is defined across multiple files.
- @terminal – aware of your VS Code integrated terminal contents, useful for debugging shell errors
- @vscode – answers questions about VS Code settings, commands, and features
You can also use #file to attach a specific file as context without switching to it. Type # in the chat input to see all available context variables.
Slash Commands
Slash commands are shorthand for common tasks. Type / in the chat input to see the full list. The most useful ones day-to-day:
- /explain – explains selected code in plain language
- /fix – analyzes an error and suggests a fix
- /tests – generates unit tests for selected code or the active file
- /doc – generates JSDoc, docstrings, or inline comments
You can combine these. For example, selecting a function and typing /tests #file:auth.service.ts tells Copilot to generate tests specifically for that function using the auth service file as additional context. Mixing slash commands with context variables is where the real productivity gains show up.
Writing Effective Prompts for Better Copilot Output

Copilot generates code based on what it can infer from context. The quality of that inference depends heavily on how clearly your code and comments signal intent. This is effectively prompt engineering for developers – except the “prompt” is often your code structure and comments, not a chat message.
Use Comments to Direct Completions
Write the comment, then let Copilot write the code.
A comment like // fetch user by ID and return 404 if not found before an empty function gives Copilot enough to generate a complete, working implementation. The more specific the comment, the more accurate the output.
This works especially well for:
- Edge case handling (“// validate that input is non-empty and a valid email format”)
- Algorithm hints (“// use binary search”)
- Pattern preferences (“// use async/await, not promise chaining”)
Variable Names and Type Annotations Matter
Copilot reads your naming as intent. getUserById tells it something very different from fetchData. Specific names combined with TypeScript type annotations or Python type hints give the model cleaner signals and tend to produce suggestions that actually fit your architecture.
Bad signal: function process(data) {}
Better signal: async function getUserById(userId: string): Promise<User | null> {}
The second version lets Copilot infer the return type, the async nature, the potential null case, and what kind of data transformation is likely needed. All without a single comment.
Inline Chat Prompts vs. Sidebar Chat
Use inline chat (Ctrl+I) when you’re editing existing code and want targeted changes – refactor this function, add error handling, convert to TypeScript. It shows a diff and you can accept or reject without context switching.
Use the sidebar chat when you need broader answers – how does this module work, what’s the best way to structure this API, generate a full component from scratch. The sidebar also supports multi-turn conversation, so you can refine output across several messages rather than starting fresh each time.
One practical tip: always select the relevant code before opening either chat mode. Copilot uses that selection as the primary context. Asking “refactor this” with nothing selected gives it very little to work with. Asking it with a 40-line function selected gives it exactly what it needs.
Copilot for Specific Workflows: Tests, Docs, Refactoring

Most people discover Copilot through inline suggestions and never dig much further. That’s leaving a lot on the table. The slash commands and chat interface cover some of the most time-consuming parts of the development process – the stuff you do after writing the initial code.
Generating Unit Tests
Select a function, open inline chat (Ctrl+I), and type /tests. Copilot generates test cases based on the function signature, existing implementation, and any patterns it infers from surrounding code.
For most deterministic, pure functions this works well out of the box. The results get more variable when:
- The function has complex side effects or external dependencies
- You haven’t specified a test framework and the project doesn’t have one already
- The function relies on business logic that isn’t visible in the current file
Adding context helps significantly. /tests use Jest, mock the database calls, test for both success and error cases gives Copilot explicit constraints to work within. Duolingo’s engineering team reported a 70% increase in pull request volume and a 67% drop in median code review turnaround time after adopting Copilot, partly driven by faster test generation and review cycles (GitHub, 2024).
Writing Documentation with /doc
Select a function or class, type /doc in inline chat. Copilot generates JSDoc, Python docstrings, or inline comments depending on the language.
The output quality depends on code clarity. Copilot reads the implementation to infer what the function does, so well-named variables and clear logic produce better documentation than tangled code. This is a useful forcing function – if Copilot generates confusing docs, that’s often a signal the code itself needs code refactoring.
Beyond function-level docs, Copilot Chat can also help generate README sections, technical documentation for APIs, and usage examples. Just describe what you need in the sidebar chat, attach the relevant file with #file, and iterate.
Refactoring Existing Code
Select the code block you want to change and use inline chat to describe the transformation:
- “Convert this to use async/await”
- “Extract this logic into a separate utility function”
- “Simplify this conditional chain”
- “Add input validation and throw descriptive errors”
Copilot shows the proposed changes as a diff. You can accept the whole thing, reject it, or ask for a different approach before committing. This loop – propose, review, iterate – is faster than writing refactors manually and tends to catch patterns you might miss, like missing edge cases or inconsistent error handling across similar functions.
For larger source control management workflows, Copilot can also generate commit messages automatically based on your staged changes. Click the sparkle icon in the Source Control panel’s commit message field.
Controlling What Copilot Sees and Suggests
Copilot reads whatever is open in your editor. That’s useful when you want it to understand your project structure, but it can become a problem if sensitive files like .env, credentials configs, or proprietary business logic end up in its context window.
The good news: you have real control over what Copilot accesses and when.
Disabling Copilot Per Language
The quickest way to restrict Copilot by file type is through VS Code’s settings.
Open Settings (Ctrl+,), search for “Copilot,” and look for the github.copilot.enable setting. It accepts a JSON object where you can toggle individual languages:
{ "github.copilot.enable": { "*": true, "yaml": false, "plaintext": false } }
You can also toggle per-language directly from the status bar. Click the Copilot icon while a file of that type is open, and select “Disable for [language].” Fast and reversible.
Content Exclusions and File Privacy
A note on .copilotignore: it’s widely referenced but has limited reliable effect in VS Code today.
Copilot’s context is based on files currently open in your editor, not a file exclusion list. If a file hasn’t been opened in the current session, Copilot won’t read it regardless of any ignore configuration. If it has been opened, Copilot may use it even if you listed it in a .copilotignore file.
The more reliable approach for sensitive files:
- Keep .env
files and secrets configs closed while working in sessions where Copilot is active
- Use GitHub’s official content exclusion settings (available on Business and Enterprise plans) at the organization level
- Disable Copilot for specific file types that tend to contain credentials
Organization-Level Controls
On Copilot Business and Enterprise, admins can enforce content exclusions across all repositories and team members. This happens at the GitHub organization level, not in VS Code settings.
What admins can control:
- Exclude specific repositories or file paths from Copilot’s context entirely
- Disable Copilot Chat for the organization
- Block suggestions that match public code (duplication detection)
- Prevent code snippets from being used in model training
For teams working on proprietary systems or handling regulated data, these controls matter more than individual settings. The Business plan prevents code snippets from being used to train public models, which is a key requirement for most companies handling sensitive intellectual property.
GitHub Copilot Free vs. Pro vs. Business in VS Code

GitHub now offers five plan tiers, though most developers will decide between Free, Pro, and Business. Each changes your VS Code experience in concrete ways, not just on paper.
| Option | What it does | Recommended value |
|---|---|---|
| target | JavaScript version for output | ES2020 for modern Node.js |
| strict | Enables all strict type checks | true (always) |
| outDir | Where compiled .js files go | ./dist |
| rootDir | Where your .ts source files live | ./src |
| sourceMap | Generates .map files for debugging | true (if you plan to debug) |
What the Free Plan Actually Gets You
2,000 inline completions and 50 premium requests per month (GitHub, 2025). That’s roughly 65 completions per day – fine for evaluation, tricky for daily professional use.
The Free plan does include access to multiple models, including GPT-4o. The limitation is volume, not capability. You’ll hit the ceiling quickly if you’re actively using Copilot Chat for documentation, test generation, or code explanations throughout the day.
Copilot Pro: The Practical Choice for Individual Developers
Unlimited completions. 300 premium requests per month. $10/month.
GitHub cut the individual plan price from $19 to $10 in early 2025 when it rebranded the tier as “Pro,” making it the most affordable premium AI coding assistant currently available (cheaper than both Cursor at $20/month and Windsurf at $15/month, according to DevTools Review, 2025).
Pro also unlocks multi-model selection in VS Code. You can switch between GPT-4o, Claude, and other available models on a per-request basis depending on the task. Heavier reasoning tasks benefit from larger models; fast completions work fine with optimized smaller ones.
Students get Copilot Pro for free through GitHub Education. Worth checking before paying.
Copilot Business and Enterprise: Team and Org Features
Business adds the features that matter for teams: organization-wide policy controls, centralized billing, IP indemnity, and the guarantee that your code isn’t used for model training.
Enterprise goes further:
- Codebase indexing for deeper, project-specific suggestions
- Custom fine-tuned models trained on your organization’s private code
- Audit logs and compliance reporting
- Copilot Chat natively on GitHub.com, not just in the IDE
For most teams, Business is the right call. Enterprise makes sense when you’re operating at scale with strict compliance requirements or want Copilot trained on your specific tech stack. Requires a GitHub Enterprise Cloud subscription to be eligible.
Gartner forecasts that 90% of enterprise software engineers will use AI coding assistants by 2028, up from less than 14% in early 2024. Plan pricing will almost certainly shift as the market matures, but the current structure rewards individual developers with affordable access while charging for organizational control features.
Common GitHub Copilot Issues in VS Code and How to Fix Them

Most Copilot problems in VS Code fall into three buckets: authentication, version mismatches, and extension conflicts. The fixes are usually quick once you know where to look.
Copilot Not Showing Suggestions
Three most common causes:
- Copilot is disabled for the current file type (check the status bar icon)
- The extension isn’t signed in or the GitHub token has expired
- The github.copilot.editor.enableAutoCompletions
setting is set to false in workspace settings
Start with the status bar. A crossed-out Copilot icon means it’s disabled for the current language, not broken. Click it to re-enable.
If the icon looks normal but no suggestions appear, sign out and back in. Open the Command Palette (Ctrl+Shift+P), run “GitHub: Sign Out,” then “GitHub: Sign In” and complete the browser authorization flow. This clears stale tokens and usually resolves the issue.
Copilot Chat Not Connecting or Returning Errors
Copilot Chat releases in lockstep with VS Code. Running an outdated VS Code version is the single most common reason Copilot Chat stops working after an update.
Check your VS Code version first. If it’s not current, update it. Then check that the GitHub Copilot Chat extension is also on its latest version, since older Chat versions can’t connect to newer backend models.
If you’re still stuck: disable the Copilot Chat extension, reload the window, then re-enable it. This clears extension state without a full reinstall and fixes a surprising number of “it just stopped working” cases.
Conflicts With Other Autocomplete Extensions
Running Copilot alongside Tabnine or Codeium can cause competing suggestions, slow completions, or one tool suppressing the other entirely.
Best practice: run one AI completion tool at a time. Disable the others while actively using Copilot, then re-enable if you want to compare. Extensions that also hook into VS Code’s inline suggestion API can interfere with each other in ways that are hard to debug without isolating them first.
If completions are slow generally (not just during conflicts), it’s usually network latency or high server load during peak hours. There’s no fix on the client side – it resolves on its own. Business and Enterprise users have had some priority routing in practice, though GitHub hasn’t documented formal SLAs for completion speed at any tier.
Authentication Loops and Token Errors
A “403 invalid token” or endless sign-in loop almost always points to the wrong GitHub account being used, or a subscription that isn’t linked to the account currently signed into VS Code.
Go to VS Code’s Accounts menu in the Activity Bar, sign out of your current GitHub account completely, then sign back in with the account that holds your active Copilot subscription. If you manage separate work and personal accounts, VS Code lets you assign different GitHub accounts per workspace, which avoids this problem entirely going forward.
For persistent issues, check the Copilot output log. Open the Output panel (Ctrl+Shift+U), select “GitHub Copilot” from the dropdown, and look for specific error messages. Those logs are also what GitHub Support will ask for if you need to escalate, so it’s worth knowing where they live.
FAQ on How To Use GitHub Copilot In VSCode
How do I install GitHub Copilot in VS Code?
Open the Extensions view with Ctrl+Shift+X, search “GitHub Copilot,” and install both the Copilot and Copilot Chat extensions. Sign in with your GitHub account when prompted. The setup takes under five minutes.
Is GitHub Copilot free in VS Code?
Yes. The Free plan gives you 2,000 inline suggestions and 50 chat requests per month. It’s enough to evaluate the tool properly. For daily professional use, Copilot Pro at $10/month removes those limits.
How do I accept or dismiss Copilot suggestions?
Press Tab to accept a suggestion. Press Escape to dismiss it. Use Alt+] and Alt+[ to cycle through alternative completions when the first suggestion isn’t quite right.
What is Copilot Chat and how do I open it?
Copilot Chat is a conversational AI panel inside VS Code. Open it with Ctrl+Alt+I. For quick in-editor edits without switching panels, use inline chat with Ctrl+I instead.
What slash commands does Copilot support?
The most useful ones: /explain for understanding code, /fix for debugging, /tests for generating unit tests, and /doc for writing documentation. Type / in chat to see the full list.
How does Copilot know what to suggest?
Copilot reads your current file, open tabs, cursor position, and nearby comments to build context. Keeping related files open in VS Code gives it a fuller picture and tends to produce more accurate inline suggestions.
Can I use Copilot for specific languages only?
Yes. Open VS Code Settings (Ctrl+,), search “Copilot,” and edit the github.copilot.enable setting. You can disable it for specific languages like YAML or plaintext while keeping it active for Python and JavaScript.
Why is Copilot not showing suggestions in VS Code?
Check the status bar icon first. A crossed-out icon means Copilot is disabled for that file type. If the icon looks normal, sign out and back in via the Command Palette to refresh your GitHub authentication token.
What is the difference between Copilot Free, Pro, and Business?
Free has monthly usage caps. Pro ($10/month) gives unlimited completions and multi-model access. Business ($19/user/month) adds team policy controls, IP indemnity, and ensures your code isn’t used to train public models.
How do I get better results from Copilot suggestions?
Write descriptive comments before functions, use specific variable names, and add type annotations. The clearer your code signals intent, the more accurate Copilot’s AI code completion becomes. Select relevant code before opening inline chat for targeted edits.
Conclusion
This conclusion is for an article presenting how to use GitHub Copilot in VS Code – and the core takeaway is simple: the tool rewards deliberate use.
Inline suggestions are just the starting point. The real productivity gains come from combining Copilot Chat, slash commands like /tests and /fix, and context variables like @workspace` to cover the repetitive parts of your workflow.
Whether you’re on the Free plan testing the waters or running Copilot Business across a team, the setup is the same – get the extensions in, sign in, and start building context-aware habits around it.
AI pair programming isn’t replacing the developer. It’s handling the boilerplate so you can focus on the parts that actually require thinking.
- How to Rename a Repository in GitHub: Quick Guide - July 28, 2026
- What Modern Teams Should Know Before Replacing Legacy PAM Tools - July 27, 2026
- How to Redeem a Google Play Gift Card - July 26, 2026



