Getting the Most Out of GitHub Copilot Chat in VS Code

Ravgeet DhillonRavgeet Dhillon
3 min read

GitHub Copilot is already an incredible tool for autocompleting code, but if you haven’t tried Copilot Chat, you’re missing out on one of the most powerful AI developer workflows available today.

In this post, you’ll walk through:

  • How to use Copilot Chat in VS Code

  • What it’s best at

  • Real-world prompts you can use right away

What Is GitHub Copilot Chat?

Copilot Chat brings the power of ChatGPT directly into VS Code, allowing you to ask natural language questions about your code, request explanations, generate tests, fix bugs, refactor logic, and more — without ever leaving your editor.

It’s like having an AI pair programmer that:

  • Understands your code context

  • Works inline or in a chat panel

  • Helps you learn, debug, and ship faster

What Can You Use Copilot Chat For?

Here are some powerful use cases:

Code Understanding & Explanation

You can highlight any block of code and ask:

  • “Explain what this code does”

  • “What is the time complexity here?”

  • “Why am I getting this TypeError?”

Code Improvement & Refactoring

Ask it to:

  • “Refactor this function to be cleaner”

  • “Optimize this loop”

  • “Suggest better variable names”

Test Generation

Save hours writing boilerplate with prompts like:

  • “Write unit tests for this function using Jest”

  • “Generate test cases for edge inputs”

Code Conversion & Migration

Let it help with transitions like:

  • “Convert this JS code to TypeScript”

  • “Rewrite this to use async/await”

  • “Switch from useEffect to React Query”

General Cleanup

Ask it to:

  • “Remove unused imports”

  • “Simplify this logic”

  • “Make this more readable”

Some Example Prompts You Can Use Right Now

Use CaseExample Prompt
Understand CodeExplain this function step by step
Improve PerformanceOptimize this loop for large datasets
Refactor LogicMake this code more readable and concise
Convert LanguageTranslate this from Python to JavaScript
Debug ErrorsFix the error in this fetch call
Generate TestsWrite unit tests for this React component
Learn ConceptsWhat is useMemo in React and when to use it?
Clean Up CodeRemove all unused variables from this file

✅ Tip: You can highlight a code block and then open Copilot Chat to get smarter, context-aware answers.

How to Enable Copilot Chat in VS Code

  1. Install the GitHub Copilot Chat extension from the VS Code Marketplace

  2. Make sure you’re signed in to GitHub with an active Copilot plan

  3. Open the Copilot Chat panel or use Cmd/Ctrl + I to start inline chat

  4. Highlight code and right-click → Ask Copilot

Final Thoughts

Copilot Chat takes the promise of AI-assisted development to the next level. It’s not just about writing code faster — it’s about thinking through problems, debugging more efficiently, and learning as you go, all inside your editor.

0
Subscribe to my newsletter

Read articles from Ravgeet Dhillon directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ravgeet Dhillon
Ravgeet Dhillon

I am a full-time Software Engineer and Technical Content Writer. I code and write about React, Vue, Flutter, Laravel, Node, Strapi, and Python. I'm based in India🇮🇳 and currently work remotely for CloudAnswers. I also author technical articles for tech startups that include Strapi, Twilio, CircleCI, Lightrun, CSS Tricks, Draft.dev and many other tech companies.