Skip to main content
This lesson covers inline suggestions: how they appear as you type, how multiple alternatives and comment-driven suggestions work, and how the “Next Edit Suggestions” feature helps during edits and refactors. Inline suggestions (like those from GitHub Copilot) make educated completions for identifiers, decorators, and function bodies as you type. For example, typing current_te can autocomplete to current_test_id based on other usages in the file, speeding up repetitive tasks and reducing context switching. Below is a compact, corrected Flask example used throughout this lesson. It uses an in-memory list as a simple database and provides a POST route to create items.
Inline completion behavior
  • Identifiers: As you type a variable or function name, suggestions can complete them based on nearby usage.
  • Routes & handlers: Typing a decorator such as @app.route or beginning a handler name can produce a full route + handler implementation suggestion.
A concise implementation for deleting all items, which inline completions commonly suggest, looks like this:
Prefer items_db.clear() to reassigning the global name (e.g., items_db = []). Clearing in-place preserves references and avoids rebinding the global variable, which is safer when other parts of the code hold references to the list.
Comment-driven suggestions Writing a clear comment describing a desired behavior can trigger inline suggestions that expand the comment into a complete implementation. For example, starting with:
An inline suggestion can replace pass with a full implementation. Here is a sample handler that creates N random items (requires the random module):
Placeholders and small utilities You can add small placeholder routes (for quickly sketching behavior) and let inline suggestions fill in details later. For example:
Multiple inline suggestions and selecting alternatives When a handler name or comment is ambiguous, the assistant might offer multiple alternative completions. You can browse and choose the most appropriate suggestion. Example: a robust suggestion for analyzing a posted list of numbers validates input and returns basic statistics:
Inline editor chat Right-clicking a symbol (for example, analyze_numbers) in many editors lets you open an inline assistant/chat to ask for rewrites, extensions, or refactors in-context. This interactive experience produces alternative implementations you can accept or reject. Next Edit Suggestions (Settings) Next Edit Suggestions surface likely follow-up edits after you make a change (rename a variable, refactor a function, etc.). Enable this feature in your editor’s Copilot settings to receive guided suggestions for related edits. The UI for these settings typically looks like this:
A dark-themed code editor settings screen (likely VS Code) open to GitHub Copilot preferences. The left pane shows a file explorer with Python files, while the main pane lists Copilot options like inline auto-completions and language-specific enable/disable values.
Next Edit Suggestions are particularly helpful when a single change implies multiple consistent edits across the file — for example, renaming items_db in one place and then accepting the assistant’s proposal to update related usages nearby.
Next Edit Suggestions are useful during refactoring — they propose subsequent edits related to the change you’re making. This feature may be in preview or evolve over time.
Routes quick reference Links and references Wrap-up This lesson demonstrated how inline features help in practice:
  • Inline completions that finish code you are actively typing.
  • Multiple suggestions and alternative completions you can pick between.
  • Comment-driven suggestions that expand comments into working code.
  • Next Edit Suggestions that propose follow-up edits while refactoring.
These inline tools can significantly speed up common coding tasks — but always review generated code for correctness, security, and maintainability.

Watch Video