Skip to main content

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:
With these helpers, you’re ready to add new features using Copilot’s multiple suggestions.

Example 1: Adding calculate_area

Type this stub and invoke the suggestions panel:
A sample completion might be:
Press Tab to insert the version you like.

Example 2: Simulating an API Request

Ask Copilot for a basic API stub:
Explore suggestions that include error handling, retries, or logging.

Example 3: Implementing QuickSort

Comment your goal and trigger multiple completions:
An efficient suggestion could be:
Insert your preferred snippet with 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.

Watch Video