You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
agent: Fix inline assistant focusing behavior for cursor placement (zed-industries#29998)
Ref: zed-industries#29919
This PR improves how inline assistants are detected and focused based on
cursor position.
### Problem
The current implementation has inconsistent behavior:
- When selecting text within an inline assistant's range, the assistant
properly focuses
- When placing a cursor on a line containing an assistant (without
selection), a new assistant is created instead of focusing the existing
one
### Solution
Enhanced the assistant detection logic to:
- Check if the cursor is anywhere within the line range of an existing
assistant
- Maintain the same behavior for both cursor placement and text
selection
- Convert both cursor position and assistant ranges to points for better
line-based comparison
This creates a more intuitive editing experience when working with
inline assistants, reducing the creation of duplicate assistants when
the user intends to interact with existing ones.
https://github.com/user-attachments/assets/55eb80d1-76a7-4d42-aac4-2702e85f13c4
Release Notes:
- agent: Improved inline assistant behavior to focus existing assistants
when cursor is placed on their line, matching selection behavior
---------
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
0 commit comments