GitHub Copilot Setup Guide for VS Code: Workspace Settings, Language Rules, Keybindings & Chat Commands

GitHub Copilot Setup Guide for VS Code: From Installation to Advanced Workflows

GitHub Copilot transforms VS Code into an AI-powered development environment. This guide walks you through complete setup including workspace-level configuration, per-language control, custom keybindings, and leveraging Copilot Chat for test generation workflows.

Prerequisites

  • VS Code version 1.90 or later- An active GitHub Copilot subscription (Individual, Business, or Enterprise)- A GitHub account authenticated in VS Code

Step 1: Install the GitHub Copilot Extensions

Open your terminal and install both extensions via the CLI: code —install-extension GitHub.copilot code —install-extension GitHub.copilot-chat

Alternatively, open VS Code, press Ctrl+Shift+X, search for GitHub Copilot, and install both GitHub Copilot and GitHub Copilot Chat. After installation, click the Accounts icon in the bottom-left corner of VS Code and sign in with your GitHub account. Authorize the OAuth flow when prompted.

Step 2: Configure Workspace-Level Settings

Workspace settings override user-level defaults for your specific project. Create or edit .vscode/settings.json in your project root: { “github.copilot.enable”: { ”*”: true, “plaintext”: false, “markdown”: true, “yaml”: true }, “github.copilot.advanced”: { “inlineSuggestCount”: 3, “listCount”: 10 }, “github.copilot.chat.localeOverride”: “en”, “editor.inlineSuggest.enabled”: true, “editor.inlineSuggest.showToolbar”: “onHover” }

This configuration enables Copilot globally, disables it for plain text files, and ensures inline suggestions appear with a hover toolbar.

Step 3: Language-Specific Enable/Disable Rules

Fine-grained language control lets you decide exactly where Copilot assists. Add these rules to your .vscode/settings.json: { “github.copilot.enable”: { "": true, “python”: true, “javascript”: true, “typescript”: true, “html”: true, “css”: false, “json”: false, “plaintext”: false, “markdown”: false, “env”: false } }

The wildcard sets the default for all languages. Individual language identifiers override the wildcard. Setting env to false is a security best practice to prevent Copilot from suggesting content based on your .env files.

Language IDRecommended SettingReason
pythontrueStrong completion quality for Python
typescripttrueExcellent type-aware suggestions
jsonfalseAvoids noisy completions in config files
envfalsePrevents secret leakage in suggestions
markdownoptionalUseful for docs, noisy for notes
## Step 4: Custom Keybindings for Copilot Open your keybindings file with Ctrl+Shift+P → **Preferences: Open Keyboard Shortcuts (JSON)** and add: [ { "key": "ctrl+shift+a", "command": "editor.action.inlineSuggest.trigger", "when": "editorTextFocus && !inlineSuggestVisible" }, { "key": "alt+]", "command": "editor.action.inlineSuggest.showNext", "when": "inlineSuggestVisible" }, { "key": "alt+[", "command": "editor.action.inlineSuggest.showPrevious", "when": "inlineSuggestVisible" }, { "key": "ctrl+shift+enter", "command": "editor.action.inlineSuggest.acceptWord", "when": "inlineSuggestVisible" }, { "key": "ctrl+shift+c", "command": "workbench.action.chat.open", "when": "editorTextFocus" }, { "key": "ctrl+shift+t", "command": "workbench.action.chat.open", "args": { "query": "/tests " }, "when": "editorTextFocus" } ]

The last keybinding opens Copilot Chat with the /tests slash command pre-filled, creating a rapid shortcut for test generation.

Step 5: Copilot Chat Slash Commands for Test Generation

Copilot Chat provides built-in slash commands accessible in the chat panel (Ctrl+Shift+I for inline chat or the Chat sidebar). Here are the key commands for test workflows:

CommandPurposeExample Usage
/testsGenerate unit tests for selected codeSelect a function → /tests
/fixFix failing tests or bugsSelect failing code → /fix
/explainUnderstand code before writing testsSelect complex logic → /explain
/docAdd documentation to clarify testable behaviorSelect function → /doc
### Test Generation Workflow - Open the file containing the function you want to test.- Select the target function in the editor.- Press Ctrl+Shift+T (using the custom keybinding above) or open Chat and type /tests.- Review the generated test code. Copilot uses your project's existing test framework when it detects one.- Refine by adding context in chat: /tests using pytest with fixtures and parametrize for edge cases.- Insert the accepted code into your test file.For framework-specific output, provide context directly: /tests Write Jest tests with describe/it blocks, mock the database module, and cover error handling paths
/tests Generate pytest tests using @pytest.mark.parametrize for the calculate_discount function with boundary values
### Custom Chat Participants and Variables

Reference files and selections for richer context: /tests #file:src/utils/parser.ts #selection

/tests Use the test patterns from #file:tests/helpers/base_test.py

Pro Tips

  • Use .github/copilot-instructions.md — Place a file at this path in your repo to give Copilot persistent project-wide instructions such as preferred frameworks, naming conventions, and architectural patterns. Copilot Chat reads this automatically.- Accept word-by-word — Use Ctrl+Right Arrow (default) or your custom keybinding to accept suggestions one word at a time for more controlled adoption.- Cycle through suggestions — Press Alt+] and Alt+[ to browse alternative completions before accepting.- Inline chat for surgical edits — Press Ctrl+I to open inline chat directly in the editor. Type /tests for contextual test generation without leaving your code.- Exclude sensitive files — Add patterns to .copilotignore (same syntax as .gitignore) to prevent Copilot from reading secrets, credentials, or proprietary logic.- Pin Copilot Chat context — Use the paperclip icon in Chat to attach files as persistent context across multiple prompts in the same session.

Troubleshooting

IssueCauseSolution
No suggestions appearingExtension disabled or auth expiredCheck status bar for Copilot icon. Click it to verify status. Re-authenticate via Ctrl+Shift+P → **GitHub Copilot: Sign In**.
Suggestions in wrong languageLanguage ID mismatchCheck the language mode in the bottom-right of VS Code. Click to change. Verify github.copilot.enable has the correct language ID.
Chat says "Copilot is not available"Subscription or network issueVerify subscription at github.com/settings/copilot. Check proxy settings: "http.proxy" in VS Code settings. Ensure *.githubusercontent.com is not blocked.
Slow or delayed suggestionsNetwork latency or large file contextReduce file size or split large files. Check "github.copilot.advanced": {"length": 2500} to limit prompt size.
Keybinding conflictsAnother extension using the same shortcutOpen Ctrl+K Ctrl+S, search for conflicting keys, and reassign or remove duplicates.
## Verifying Your Setup

Run this quick checklist after configuration: - Open a .ts or .py file and start typing a function — inline suggestions should appear.- Open a .json file — no suggestions should appear if you disabled it.- Press Ctrl+Shift+T — Copilot Chat should open with /tests pre-filled.- Select a function and type /tests in Chat — test code should be generated.- Check the Copilot status icon in the status bar — it should show as active. ## Frequently Asked Questions

Can I use different Copilot settings for different projects?

Yes. Workspace-level settings in .vscode/settings.json override your global user settings. Each project can have its own Copilot enable/disable rules, language filters, and inline suggestion preferences. This is especially useful in monorepos where some directories contain sensitive code. You can also use the multi-root workspace feature to apply different settings per folder.

How do I prevent Copilot from suggesting code based on my secrets or environment files?

Create a .copilotignore file in your project root using the same syntax as .gitignore. Add patterns like .env, .pem, secrets/, and config/credentials.. Additionally, set “env”: false in your github.copilot.enable configuration to disable suggestions entirely when editing environment files. For organization-wide policies, GitHub Copilot Business and Enterprise admins can configure content exclusion rules in the organization settings.

Does the /tests slash command support all test frameworks automatically?

Copilot Chat detects your project’s test framework by analyzing existing test files, package.json dependencies, requirements.txt, or build tool configurations. It supports Jest, Mocha, pytest, unittest, JUnit, xUnit, RSpec, and many others. If detection fails or you want a specific framework, explicitly state it in your prompt — for example, /tests using vitest with describe blocks. Providing an example test file as context with #file: further improves framework accuracy.

Explore More Tools

Grok Best Practices for Real-Time News Analysis and Fact-Checking with X Post Sourcing Best Practices Devin Best Practices: Delegating Multi-File Refactoring with Spec Docs, Branch Isolation & Code Review Checkpoints Best Practices Bolt Case Study: How a Solo Developer Shipped a Full-Stack SaaS MVP in One Weekend Case Study Midjourney Case Study: How an Indie Game Studio Created 200 Consistent Character Assets with Style References and Prompt Chaining Case Study How to Install and Configure Antigravity AI for Automated Physics Simulation Workflows Guide How to Set Up Runway Gen-3 Alpha for AI Video Generation: Complete Configuration Guide Guide Replit Agent vs Cursor AI vs GitHub Copilot Workspace: Full-Stack Prototyping Compared (2026) Comparison How to Build a Multi-Page SaaS Landing Site in v0 with Reusable Components and Next.js Export How-To Kling AI vs Runway Gen-3 vs Pika Labs: Complete AI Video Generation Comparison (2026) Comparison Claude 3.5 Sonnet vs GPT-4o vs Gemini 1.5 Pro: Long-Document Summarization Compared (2025) Comparison Midjourney v6 vs DALL-E 3 vs Stable Diffusion XL: Product Photography Comparison 2025 Comparison Runway Gen-3 Alpha vs Pika 1.0 vs Kling AI: Short-Form Video Ad Creation Compared (2026) Comparison BMI Calculator - Free Online Body Mass Index Tool Calculator Retirement Savings Calculator - Free Online Planner Calculator 13-Week Cash Flow Forecasting Best Practices for Small Businesses: Weekly Updates, Collections Tracking, and Scenario Planning Best Practices 30-60-90 Day Onboarding Plan Template for New Marketing Managers Template Accounts Payable Automation Case Study: How a Multi-Location Restaurant Group Cut Invoice Processing Time With OCR and Approval Routing Case Study Amazon PPC Case Study: How a Private Label Supplement Brand Lowered ACOS With Negative Keyword Mining and Exact-Match Campaigns Case Study Antigravity vs Jasper vs Copy.ai: AI Brand Voice Consistency Compared (2026) Comparison Apartment Move-Out Checklist for Renters: Cleaning, Damage Photos, and Security Deposit Return Checklist