Skip to main content
Explore how GitHub Copilot’s inline chat accelerates code explanation, refactoring, generation, and testing directly within your editor—without context switching.
Ensure you have the GitHub Copilot extension installed and enabled in your IDE to use inline chat.

Opening Inline Chat

Use one of the following methods to launch the inline chat panel:

Explaining Code Inline

Highlight any function or block, type explain (or /explain), and Copilot injects an inline comment detailing its behavior. For example:
If you prefer the full chat experience, click View in chat to see this explanation in the traditional chat window.

Refactoring Hard-Coded Values

Use inline chat to replace literals with external configuration.
Original:
Refactored using JSON:
Toggle the “before” and “after” diff in inline chat to review changes.

Consolidating Configuration Constants

At the top of your file, organize all constants for clarity and easy maintenance:

Generating New Code with Inline Chat

Prompt Copilot to scaffold helper functions. For instance, generate get_light_state logic:

Creating Unit Tests with Pytest

Copilot can also generate test scaffolding. For example:
Always install and pin your test dependencies to avoid mismatched versions:

References

Watch Video