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 Academic Research and Literature Discovery: Leveraging X/Twitter for Scholarly Intelligence Best Practices Grok Best Practices for Content Strategy: Identify Trending Topics Before They Peak and Create Content That Captures Demand Best Practices Grok Case Study: How a DTC Beauty Brand Used Real-Time Social Listening to Save Their Product Launch Case Study Grok Case Study: How a Pharma Company Tracked Patient Sentiment During a Drug Launch and Caught a Safety Signal 48 Hours Before the FDA Case Study Grok Case Study: How a Disaster Relief Nonprofit Used Real-Time X/Twitter Monitoring to Coordinate Emergency Response 3x Faster Case Study Grok Case Study: How a Political Campaign Used X/Twitter Sentiment Analysis to Reshape Messaging and Win a Swing District Case Study How to Use Grok for Competitive Intelligence: Track Product Launches, Pricing Changes, and Market Positioning in Real Time How-To Grok vs Perplexity vs ChatGPT Search for Real-Time Information: Which AI Search Tool Is Most Accurate in 2026? Comparison How to Use Grok for Crisis Communication Monitoring: Detect, Assess, and Respond to PR Emergencies in Real Time How-To How to Use Grok for Product Improvement: Extract Customer Feedback Signals from X/Twitter That Your Support Team Misses How-To How to Use Grok for Conference Live Monitoring: Extract Event Insights and Identify Networking Opportunities in Real Time How-To How to Use Grok for Influencer Marketing: Discover, Vet, and Track Influencer Partnerships Using Real X/Twitter Data How-To How to Use Grok for Job Market Analysis: Track Industry Hiring Trends, Layoff Signals, and Salary Discussions on X/Twitter How-To How to Use Grok for Investor Relations: Track Earnings Sentiment, Analyst Reactions, and Shareholder Concerns in Real Time How-To How to Use Grok for Recruitment and Talent Intelligence: Identifying Hiring Signals from X/Twitter Data How-To How to Use Grok for Startup Fundraising Intelligence: Track Investor Sentiment, VC Activity, and Funding Trends on X/Twitter How-To How to Use Grok for Regulatory Compliance Monitoring: Real-Time Policy Tracking Across Industries How-To NotebookLM Best Practices for Financial Analysts: Due Diligence, Investment Research & Risk Factor Analysis Across SEC Filings Best Practices NotebookLM Best Practices for Teachers: Build Curriculum-Aligned Lesson Plans, Study Guides, and Assessment Materials from Your Own Resources Best Practices NotebookLM Case Study: How an Insurance Company Built a Claims Processing Training System That Cut Errors by 35% Case Study