Quick Q&A

Getting the quick answer to your question.

Description

In the collaborative coding environment, quick interactions and clarifications are often key to efficient development. While GitHub has the "GitHub Copilot Chat" product for more structured and extensive conversations, the "Quick Q&A" technique serves as a lightweight alternative. It enables developers to rapidly engage with Copilot in the code editor for brief one-liner answers and insights. It's not a distinct feature but a method that leverages commenting for quick interactions with Copilot, making it an agile and handy tool for on-the-spot guidance.

Example

Using the Quick Chat technique, you can pose questions directly in your code and get brief responses from Copilot:

# me: What's the best way to optimize this loop?
# copilot: 

Then GitHub Copilot will answer to the question

# me: What's the best way to optimize this loop?
# copilot: Consider using a vectorized approach or caching intermediate results. 

It can be just "q:" and "a:"

// q: How do I get the current time in milliseconds?
// a: 

For more context-based dialogue, roles can be defined:

# Roles: copilot
#   Expert in Python with 15+ years of experience
# Role: me
#   Mid-level engineer
#
# me: What's the best way to optimize this loop?
# copilot: Consider using a vectorized approach or caching intermediate results. 

Exercise

  • Exercise 1: Compare Quick Chat with "copilot chat" by engaging with both and noting the differences.

  • Exercise 2: Use Quick Chat to get one-liner answers to three different coding questions.

  • Exercise 3: Define roles within Quick Chat and observe how contextual information affects Copilot's responses.

Checklist for Further Learning

  • How does Quick Chat differ from the "copilot chat" product, and when might one be preferred over the other?

  • How can the Quick Chat technique be integrated into various stages of the development process?

  • What are the potential drawbacks or limitations of using Quick Chat, and how might they be mitigated?

Last updated