Skip to main content
This lesson shows how inline chat integrates with the code editor so you can generate small edits without leaving your file. Inline generation is optimized for targeted changes (helpers, docstrings, micro-refactors), while the full chat window is better for extended conversations or preserving long context. Quick highlights:
  • Open the global chat window with Command+L (macOS) or Ctrl+L (Windows/Linux).
  • Trigger inline generation at the caret with Command+K (macOS) or Ctrl+K (Windows/Linux).
  • Inline edits present a diff directly in the editor (green = additions, red = removals). Accept or reject with the UI or keyboard shortcuts (for example, Command+Y / Command+N on macOS).
Inline editing is useful for small, iterative changes (refactors, quick helpers, micro-optimizations). Use the full chat window when you need a longer discussion or to preserve a long context.

When to use inline edits vs full chat

Keyboard shortcuts

Example: editing a Flask-like app inline

Below is a compact, corrected example of a Flask-like application fragment you might edit inline. It shows typical structure and small helpers you might add during a focused edit session.
Say you ask the inline generator: “Create a function to reverse a string.” The generator can insert a small helper directly in your file:
The inline UI highlights the proposed changes with an inline diff. Accept the changes to merge them into the file, or reject to keep the original. When iterating, small follow-ups are straightforward. For example, “append ‘Hello, world’ after the reversed string” can be applied inline and shown as a concise diff. If you request more substantial changes — such as “add error handling and logging to the authentication decorator” — the generator can propose a more complete, hardened replacement. Here is an example of a consolidated login_required decorator that adds logging and graceful error handling while preserving functools.wraps:
A note about prototypes vs production code:
  • Small inline edits are great for iterating quickly, but always review and harden prototypes before deploying.
  • For example, do not use raw SHA-1 for storing passwords in production.
Do not use raw SHA-1 for password hashing in production. Use a secure password hashing method such as werkzeug.security.generate_password_hash / check_password_hash, bcrypt, or argon2.
Example using Werkzeug’s helpers:

Best practices for inline AI edits

  • Keep inline generation for targeted, small changes: helpers, single-function refactors, docstrings, or micro-optimizations.
  • Use the full chat window when you need extended back-and-forth, design discussions, or to maintain long context across many edits.
  • Always review generated diffs before accepting—treat them like a code review.
  • Replace any quick prototypes (e.g., SHA-1 examples) with production-grade libraries and established patterns when hardening your application.
  • Add tests for any generated code that affects behavior or security.
Inline chat helps you stay immersed in your code and iterate faster without switching contexts. Use it for quick, focused edits and keep the full chat for broader design or debugging sessions.

Watch Video