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

Antigravity AI Content Pipeline Automation Guide: Google Docs to WordPress Publishing Workflow Guide Bolt.new Case Study: Marketing Agency Built 5 Client Dashboards in One Day Case Study Bolt.new Best Practices: Rapid Full-Stack App Generation from Natural Language Prompts Best Practices ChatGPT Advanced Data Analysis (Code Interpreter) Complete Guide: Upload, Analyze, Visualize Guide ChatGPT Custom GPTs Advanced Guide: Actions, API Integration, and Knowledge Base Configuration Guide ChatGPT Voice Mode Guide: Build Voice-First Customer Service and Internal Workflows Guide Claude API Production Chatbot Guide: System Prompt Architecture for Reliable AI Assistants Guide Claude Artifacts Best Practices: Create Interactive Dashboards, Documents, and Code Previews Best Practices Claude Code Hooks Guide: Automate Custom Workflows with Pre and Post Execution Hooks Guide Claude MCP Server Setup Guide: Build Custom Tool Integrations for Claude Code and Claude Desktop Guide Cursor Composer Complete Guide: Multi-File Editing, Inline Diffs, and Agent Mode Guide Cursor Case Study: Solo Founder Built a Next.js SaaS MVP in 2 Weeks with AI-Assisted Development Case Study Cursor Rules Advanced Guide: Project-Specific AI Configuration and Team Coding Standards Guide Devin AI Team Workflow Integration Best Practices: Slack, GitHub, and Code Review Automation Best Practices Devin Case Study: Automated Dependency Upgrade Across 500-Package Python Monorepo Case Study ElevenLabs Case Study: EdTech Startup Localized 200 Course Hours to 8 Languages in 6 Weeks Case Study ElevenLabs Multilingual Dubbing Guide: Automated Video Localization Workflow for Global Content Guide ElevenLabs Voice Design Complete Guide: Create Consistent Character Voices for Games, Podcasts, and Apps Guide Gemini 2.5 Pro vs Claude Sonnet 4 vs GPT-4o: AI Code Generation Comparison 2026 Comparison Gemini API Multimodal Developer Guide: Image, Video, and Document Analysis with Code Examples Guide