DEV Community

Cover image for Getting the Most Out of GitHub Copilot Chat in VS Code
Ravgeet Dhillon
Ravgeet Dhillon

Posted on • Edited on • Originally published at ravgeet.in

Getting the Most Out of GitHub Copilot Chat in VS Code

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 Case Example Prompt
Understand Code Explain this function step by step
Improve Performance Optimize this loop for large datasets
Refactor Logic Make this code more readable and concise
Convert Language Translate this from Python to JavaScript
Debug Errors Fix the error in this fetch call
Generate Tests Write unit tests for this React component
Learn Concepts What is useMemo in React and when to use it?
Clean Up Code Remove 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.

Top comments (3)

Collapse
 
dotallio profile image
Dotallio

Love the concrete prompt examples here, they make it way easier to get real value out of Copilot Chat. Do you have any go-to prompts for trickier debugging or edge cases?

Collapse
 
0hep_ profile image
0hep_

GitHub Copilot is really good. The only real struggle I have found is that it impacts learning a lot.

Great post.

Collapse
 
ravgeetdhillon profile image
Ravgeet Dhillon

No, I think it is the opposite. Whenever I see a complex code that is difficult to read, I just ask Copilot , "Tell me what's happening with this code". The follow-up question can be, "What can go wrong with this code? List some use cases if possible". Based on these prompts, you can see those usecases which you sometime might miss.

So, overall, it's been really helpful.