Overview
Unlock GitHub Copilot’s power to explore and choose from multiple AI-generated code completions. This feature enhances productivity by letting you compare different implementations and pick the one that best fits your style and requirements.Accessing Multiple Suggestions
Use the following shortcut to open the suggestions panel:
Once the panel appears, browse suggestions with the same shortcut and press
Tab to insert your chosen snippet.
Use
Alt + [ (or Option + [) to navigate back to the previous suggestion.Base Code: Traffic Light Functions
Start with these core functions in your file:Example 1: Adding calculate_area
Type this stub and invoke the suggestions panel:
Tab to insert the version you like.
Example 2: Simulating an API Request
Ask Copilot for a basic API stub:Example 3: Implementing QuickSort
Comment your goal and trigger multiple completions:Tab.
Review all AI-generated code carefully. Ensure it meets your performance, security, and style guidelines before merging.
Tips for Choosing Suggestions
- Review each completion for correctness and readability.
- Browse beyond the first suggestion to discover alternative approaches.
- Compare implementations side by side to select the best fit.
- Adapt accepted code to align with your project’s conventions and standards.