How To Use Github Copilot Chat How To Use Github Copilot Chat

How to Use GitHub Copilot Chat: Complete Guide (2025)

Master GitHub Copilot Chat with this step-by-step guide. Learn slash commands, context selection, inline chat, and expert tips for 10x productivity.

GitHub Copilot Chat was a game-changer for me. I’d been using Copilot’s autocomplete for months, but when I discovered Chat, my coding speed literally doubled. The problem? I spent the first week not knowing how to use it properly.

Most developers install Copilot Chat and expect it to “just work.” They open the chat panel, type “help me with this code,” and get frustrated when the AI doesn’t understand the context. I did the same thing.

After using GitHub Copilot Chat daily for six months, I’ve learned that there’s a specific way to interact with it to get the best results. The difference between mediocre and excellent responses comes down to knowing three things: slash commands, context selection, and when to use inline vs panel chat.

This guide will show you exactly how to use GitHub Copilot Chat effectively, with real examples from my daily workflow.


Quick Start Summary

What You’ll Learn:
– How to open and navigate Copilot Chat
– Slash commands that save time (/explain, /fix, /tests)
– How to select context for better responses
– Inline chat vs sidebar chat (when to use each)
– Advanced techniques for debugging and refactoring
– Common mistakes and how to avoid them

Prerequisites:
– GitHub Copilot subscription ($10/month or free for students)
– VS Code with GitHub Copilot Chat extension installed
– Basic understanding of your programming language

Time Investment: 20 minutes to learn basics, 2-3 days to build good habits


Step 1: Install GitHub Copilot Chat

If you haven’t installed Copilot Chat yet, here’s the quick setup:

Installation Steps

  1. Get GitHub Copilot subscription
  2. Go to github.com/features/copilot
  3. Start free trial or subscribe ($10/month individual, $19/month business)
  4. Students/teachers get it free through GitHub Education
  5. Install VS Code extensions
  6. Open VS Code
  7. Go to Extensions (Ctrl+Shift+X or Cmd+Shift+X)
  8. Search for “GitHub Copilot”
  9. Install both extensions:
    • GitHub Copilot (for autocomplete)
    • GitHub Copilot Chat (for chat interface)
  10. Sign in to GitHub
  11. Click the account icon in the bottom-left
  12. Select “Sign in with GitHub”
  13. Authorise VS Code when prompted
  14. Verify installation
  15. Look for the chat icon in your left sidebar
  16. Press Ctrl+I (Cmd+I on Mac) to open inline chat
  17. You should see the “Ask Copilot…” input box

Troubleshooting: If chat doesn’t appear, restart VS Code. Still not working? Check that your GitHub account has an active Copilot subscription at github.com/settings/copilot.


Step 2: Understanding the Two Chat Interfaces

This confused me initially: GitHub Copilot Chat has two different interfaces. Knowing when to use each one is critical.

When to use:
– General questions about your codebase
– Explaining concepts or documentation
– Multi-step conversations
– When you want to reference multiple files

How to open:
– Click the chat icon in the left sidebar, OR
– Press Ctrl+Alt+I (Cmd+Alt+I on Mac), OR
– Right-click code → “Copilot” → “Open Chat”

Best for: Exploration, learning, high-level questions

Inline Chat

When to use:
– Quick edits to specific code
– Generating code at cursor position
– Refactoring selected code
– When you want immediate code insertion

How to open:
– Press Ctrl+I (Cmd+I on Mac)
– Inline chat appears directly in your editor

Best for: Fast code generation, targeted edits, refactoring

My Rule of Thumb

I use inline chat for 80% of my coding work because it’s faster and inserts code directly. I switch to sidebar chat when I need to ask follow-up questions or understand something conceptually.


Step 3: Master Slash Commands

Slash commands are the secret to getting better responses faster. Instead of typing “can you explain this code to me,” you type /explain.

Essential Slash Commands

Here are the commands I use every day:

/explain – Understand code

Select code → Ctrl+I → Type: /explain

Copilot explains what the selected code does, line by line. Perfect for understanding legacy code or complex algorithms.

/fix – Debug errors

Select buggy code → Ctrl+I → Type: /fix

Copilot analyses the code, identifies issues, and suggests fixes. I use this constantly when dealing with compilation errors.

/tests – Generate unit tests

Select functionCtrl+IType: /tests
Code language: JavaScript (javascript)

Copilot generates test cases covering edge cases. Saves hours of writing boilerplate test code.

/doc – Generate documentation

Select functionCtrl+IType: /doc
Code language: JavaScript (javascript)

Creates JSDoc, docstrings, or inline comments explaining parameters, return values, and behavior.

/simplify – Refactor complex code

Select complicated functionCtrl+IType: /simplify
Code language: JavaScript (javascript)

Copilot refactors the code to be more readable without changing functionality.

/new – Scaffold new code

Ctrl+I → Type: /new create a React component for user profile card
Code language: PHP (php)

Generates entire files or components from scratch.

Advanced Slash Commands

@workspace – Search entire codebase

In chat panel: @workspace how is authentication handled?
Code language: CSS (css)

Copilot scans your entire project to answer. Incredibly useful for understanding large codebases.

@terminal – Reference terminal output

In chat panel: @terminal why did this build fail?
Code language: JavaScript (javascript)

Copilot reads your terminal output and explains errors.

@vscode – Ask about VS Code

In chat panel: @vscode how do I set up debugging for Node.js?
Code language: JavaScript (javascript)

Get help with VS Code features and configuration.


Step 4: Select Context for Better Answers

This is the #1 mistake I see developers make: asking questions without providing context.

The Context Problem

Bad approach:

User: "How do I fix this error?"
Copilot: "What error? Please provide more details."
Code language: JavaScript (javascript)

Good approach:

User: [Selects error message + surrounding code] → Ctrl+I → /fix
Copilot: [Provides specific fix based on actual code]
Code language: HTTP (http)

How to Provide Context

1. Select relevant code
Before opening chat, highlight the code you’re asking about. Copilot automatically uses selected code as context.

2. Reference files explicitly

In chat: "Looking at UserService.ts and AuthController.ts, how do these work together?"
Code language: CSS (css)

Use #file:filename.ts syntax to reference specific files.

3. Include error messages
Copy-paste error messages directly into chat. Copilot can debug much better when it sees the actual error.

4. Use @workspace for project-wide questions

@workspace where is the user authentication logic implemented?
Code language: CSS (css)

My Context Selection Strategy

  • For bugs: Select 10-20 lines around the error + error message
  • For refactoring: Select entire function or class
  • For explanations: Select the specific section you don’t understand
  • For new features: Open relevant existing code + describe what you want

Step 5: Inline Chat Workflow (Most Important)

This is how I code 90% of the time now:

The Fast Coding Flow

  1. Write a comment describing what you want
    javascript
    // Create a function that validates email format and returns boolean
  2. Press Ctrl+I (Cmd+I)
    Inline chat opens at the cursor position
  3. Press Enter
    Copilot generates code based on your comment
  4. Review and accept
  5. Press Tab to accept the suggestion
  6. Press Escape to reject
  7. Press Ctrl+I again to modify the request

Real Example

Here’s my actual workflow from this morning:

// I wrote this comment:
// Create a debounce function that delays execution by 300ms

// Pressed Ctrl+I → Enter
// Copilot generated this:

function debounce(func, delay = 300) {
  let timeoutId;
  return function (...args) {
    clearTimeout(timeoutId);
    timeoutId = setTimeout(() => {
      func.apply(this, args);
    }, delay);
  };
}
Code language: JavaScript (javascript)

Total time: 5 seconds. Writing this manually would take 2-3 minutes.

Inline Chat for Refactoring

  1. Select the code you want to refactor
  2. Press Ctrl+I
  3. Type what you want changed
  4. “Convert to async/await”
  5. “Extract this into a separate function”
  6. “Add error handling”
  7. “Make this more performant”

Example:

// Original callback hell:
fetchUser(id, (user) => {
  fetchPosts(user.id, (posts) => {
    renderPosts(posts);
  });
});

// Selected code → Ctrl+I → "Convert to async/await"
// Copilot refactored to:

async function loadUserPosts(id) {
  const user = await fetchUser(id);
  const posts = await fetchPosts(user.id);
  renderPosts(posts);
}
Code language: JavaScript (javascript)

Step 6: Sidebar Chat for Complex Discussions

Use the sidebar chat when you need to have a conversation.

When I Use Sidebar Chat

Debugging complex issues:

Me: @workspace I'm getting "Cannot read property 'id' of undefined" in UserProfile component
Copilot: Let me check... [scans codebase]
Copilot: The issue is in line 47 of UserProfile.tsx. The user prop isn't being validated...
Me: How should I fix this?
Copilot: Add optional chaining...
Code language: HTTP (http)

Understanding architecture:

Me: @workspace explain how the authentication flow works in this app
Copilot: [Provides step-by-step explanation with file references]
Me: Where is the JWT token stored?
Copilot: In localStorage, set by AuthService.ts line 23...
Code language: CSS (css)

Learning new concepts:

Me: Explain the difference between useMemo and useCallback in React
Copilot: [Detailed explanation with examples]
Me: Show me a real-world example where useMemo improves performance
Copilot: [Provides example from your codebase]
Code language: HTTP (http)

Step 7: Advanced Techniques

Multi-File Refactoring

Here’s a technique I discovered recently:

  1. Open sidebar chat
  2. Type: @workspace I need to rename the User interface to UserAccount across all files. Show me which files need updating.
  3. Copilot lists all files
  4. Use inline chat in each file: “Rename User to UserAccount”

Generating Tests from Implementation

My workflow for adding tests:

  1. Write the feature code first
  2. Select the entire function
  3. Ctrl+I → /tests
  4. Review generated tests, accept or modify
  5. Run tests, if failures occur:
  6. Copy error message
  7. Ctrl+I → /fix + paste error
  8. Copilot fixes the test

Code Review with Copilot

Before committing code:

  1. Select changed code
  2. Ctrl+I → “Review this code for bugs, performance issues, and best practices”
  3. Copilot points out potential issues
  4. Fix issues before commit

Common Mistakes and How to Avoid Them

Mistake 1: Not Selecting Code Before Asking

Problem: “Why isn’t my function working?”
Solution: Select the function first, then ask

Mistake 2: Vague Questions

Bad: “Make this better”
Good: “Refactor this to use async/await and add error handling”

Mistake 3: Accepting Code Without Review

Always read generated code. Copilot can make mistakes, especially with:
– Security-sensitive code (auth, validation)
– Edge cases
– Performance-critical sections

Mistake 4: Not Using Slash Commands

Slow: Type “Can you please explain what this code does?”
Fast: /explain

Mistake 5: Using the Sidebar When Inline Would Be Faster

If you want code inserted immediately, use Ctrl+I (inline), not the sidebar.


Pro Tips I Learned the Hard Way

Tip 1: Chain Commands

Select function → /testsAccept tests → /docAccept documentation
Code language: JavaScript (javascript)

Generate tests and docs in 10 seconds.

Tip 2: Use Natural Language

Copilot understands context:
– “Make this safer” (adds validation)
– “Optimise this” (improves performance)
– “Add logging here” (inserts console.log or proper logging)

Tip 3: Reference Other Files

"Implement this the same way as UserService.ts handles errors"
Code language: JSON / JSON with Comments (json)

Copilot will mimic patterns from other files.

Tip 4: Iterative Refinement

Don’t accept the first response. Ask follow-ups:

Me: Create a login form component
Copilot: [Generates basic form]
Me: Add form validation with yup
Copilot: [Adds validation]
Me: Add loading state during submission
Copilot: [Adds loading state]
Code language: HTTP (http)

Tip 5: Learn Your Shortcuts

Muscle memory is key:
Ctrl+I (inline chat) – I use this 100+ times per day
Ctrl+Alt+I (sidebar chat) – For exploration
Tab (accept suggestion) – Confirm generation
Escape (dismiss) – Reject and try again


Keyboard Shortcuts Cheat Sheet

ActionWindows/LinuxMac
Open inline chatCtrl+ICmd+I
Open sidebar chatCtrl+Alt+ICmd+Alt+I
Accept suggestionTabTab
Dismiss suggestionEscapeEscape
Next suggestionAlt+]Option+]
Previous suggestionAlt+[Option+[
Toggle CopilotCtrl+Alt+OCmd+Alt+O

Troubleshooting Common Issues

Issue 1: Copilot Chat Not Responding

Solution:
1. Check internet connection
2. Verify subscription at github.com/settings/copilot
3. Restart VS Code
4. Sign out and sign back in

Issue 2: Suggestions Are Irrelevant

Solution:
– Provide more context (select more code)
– Be more specific in your prompt
– Check that you’re in the right file
– Try rephrasing your question

Issue 3: Inline Chat Not Inserting Code

Solution:
– Press Tab to accept (not Enter)
– Ensure the cursor is at the correct position
– Try using sidebar chat instead if inline fails

Issue 4: Can’t Find Slash Commands

Solution:
– Type / in chat to see available commands
– Update to the latest GitHub Copilot Chat extension
– Some commands only work in sidebar chat (like @workspace)


Comparison: Copilot Chat vs Other Tools

Copilot Chat vs Cursor’s Composer

Copilot Chat advantages:
– Native VS Code integration
– Better at following existing code patterns
– More reliable autocomplete
– Lower price ($10 vs $20)

Cursor Composer advantages:
– Multi-file editing in one prompt
– Better at large refactors
– More context awareness

When I use each:
– Copilot Chat: Daily coding, small-to-medium tasks
– Cursor: Large refactors, new features spanning multiple files

Copilot Chat vs ChatGPT

Copilot Chat advantages:
– Sees your entire codebase
– Inserts code directly into the editor
– Context-aware suggestions
– No copy-pasting

ChatGPT advantages:
– Better at explaining concepts
– More detailed explanations
– Can handle non-code questions


Best Practices Summary

Do:
– ✓ Select code before asking questions
– ✓ Use slash commands for common tasks
– ✓ Review generated code before accepting
– ✓ Use inline chat for speed
– ✓ Provide specific, clear instructions
– ✓ Reference files explicitly when needed

Don’t:
– ✕ Ask vague questions without context
– ✕ Accept code blindly (especially auth/security)
– ✕ Use sidebar chat for simple code generation
– ✕ Forget to select the relevant code first
– ✕ Expect perfection on the first generation
– ✕ Use it for sensitive data/secrets


Real-World Workflow Example

Here’s how I used Copilot Chat yesterday to build a feature:

Task: Add email validation to the signup form

Step 1: Inline chat – Generate validation function

// Wrote: "Create email validation function using regex"
// Copilot generated the validator in 3 seconds
Code language: JSON / JSON with Comments (json)

Step 2: Inline chat – Add to form

// Selected form code → Ctrl+I → "Add email validation using validateEmail function"
// Copilot integrated it perfectly
Code language: JSON / JSON with Comments (json)

Step 3: Inline chat – Generate tests

// Selected validateEmail → /tests
// Copilot created 8 test cases including edge cases
Code language: JSON / JSON with Comments (json)

Step 4: Sidebar chat – Fix test error

// Pasted error message: "Expected false but got true for 'test@'"
// Copilot: "The regex needs to require characters after @. Update line 3..."
Code language: PHP (php)

Total time: 8 minutes (would have taken 45 minutes manually)


Next Steps

Now that you know how to use GitHub Copilot Chat effectively:

  1. Practice the shortcuts – Especially Ctrl+I for inline chat
  2. Try all slash commands/explain, /fix, /tests, /doc
  3. Experiment with context – Select different amounts of code
  4. Read related guides:
  5. How to Use GitHub Copilot – Full Copilot guide
  6. Cursor vs GitHub Copilot – Compare both tools
  7. Best AI Code Editors 2025 – See alternatives

FAQ

Is GitHub Copilot Chat free?

No, Copilot Chat requires a GitHub Copilot subscription ($10/month for individuals, $19/month for business). Students and verified teachers get it free through GitHub Education.

What’s the difference between Copilot and Copilot Chat?

Copilot (autocomplete) suggests code as you type. Copilot Chat lets you have conversations about code, ask questions, and request specific changes. You need both extensions installed – they work together.

Can Copilot Chat see my entire codebase?

Yes, when you use @workspace in sidebar chat. However, inline chat only sees the current file and selected code. For project-wide questions, always use @workspace in sidebar chat.

Does Copilot Chat work with all programming languages?

Yes, but quality varies. It works best with JavaScript, TypeScript, Python, Java, and Go. Less common languages may get less accurate suggestions. It also understands multiple languages in the same project.

Can I use Copilot Chat offline?

No, Copilot Chat requires an internet connection. It sends your code to GitHub’s servers for processing. If you’re concerned about code privacy, review GitHub’s privacy policy or consider using it only with public/non-sensitive code.

How do I stop Copilot from seeing specific files?

Create a .copilotignore file in your project root:

# Example .copilotignore
.env
secrets/
config/credentials.json
Code language: PHP (php)

Is the code generated by Copilot Chat copyrighted?

GitHub’s position: You own the code Copilot generates. However, there’s ongoing debate about this. For commercial projects, review your company’s policy on AI-generated code.

Can Copilot Chat write entire applications?

No. Copilot Chat excels at writing functions, components, and small features. For entire applications, you’ll need to break the work into smaller pieces and guide the process. It’s a productivity multiplier, not a replacement for developers.


Related Articles:
How to Use Cursor AI: Complete Beginner’s Guide
GitHub Copilot vs Cursor: Which AI Coding Assistant is Better?
Best AI Code Editors and IDEs for 2025


Last updated: January 2025

Leave a Reply

Your email address will not be published. Required fields are marked *