Skip to content

agent_ui: Trigger @-mention menu after opening brackets#55504

Merged
bennetbo merged 2 commits into
mainfrom
fix-at-mention-word-boundary-8c8a637ef0764508
May 19, 2026
Merged

agent_ui: Trigger @-mention menu after opening brackets#55504
bennetbo merged 2 commits into
mainfrom
fix-at-mention-word-boundary-8c8a637ef0764508

Conversation

@yeskunall

@yeskunall yeskunall commented May 2, 2026

Copy link
Copy Markdown
Member

Typing @ immediately after (, [, or { did not open the Agent Panel’s @-mention completion menu, so (@file), [@file], and {@file} were unusable. This has been bothering me for quite some time now. Overall, I believe this is a QoL improvement, albeit a small one.

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Release Notes:

  • Fixed the Agent Panel’s @-mention menu not appearing when @ immediately follows (, [, or {.

Typing `@` immediately after `(`, `[`, or `{` did not open the agent
panel's @-mention completion menu, so `(@file)`, `[@file]`, and
`{@file}` were unusable.

The comment in `MentionCompletion::try_parse` claimed the parser
required a "word boundary before `@`", but the implementation only
treated whitespace (and start-of-line) as a boundary - any
non-whitespace character disqualified the `@`. A real `\b`-style word
boundary would have treated brackets as boundaries (since they are
not word characters), so the user-visible behavior should have matched
the comment all along.

The minimal `\b`-style fix - treating any non-word char as a boundary -
would have regressed `@fetch` URL parsing. URLs frequently contain
`/@`, and treating `/` as a boundary makes the inner `@` (e.g. `@org`
in `https://example.com/@org/@repo/file`) win over the leading
`@fetch`, breaking existing tests.

Instead, allow exactly the three opening brackets the user reported,
alongside whitespace. Closing `)`, `]`, `}` are deliberately not
boundaries; they almost always follow a word in prose, and the existing
`test@` / `Lorem@symbol` negatives already cover that path.

The new tests cover one positive case per arm of
`matches!(c, '(' | '[' | '{')`, so the suite shrinks to zero if the fix
is reverted.
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label May 2, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label May 2, 2026
@bennetbo bennetbo enabled auto-merge May 19, 2026 09:58
@bennetbo bennetbo added this pull request to the merge queue May 19, 2026
Merged via the queue into main with commit 85f4100 May 19, 2026
32 checks passed
@bennetbo bennetbo deleted the fix-at-mention-word-boundary-8c8a637ef0764508 branch May 19, 2026 10:08
TomPlanche pushed a commit to TomPlanche/zed that referenced this pull request May 20, 2026
…es#55504)

Typing `@` immediately after `(`, `[`, or `{` did not open the Agent
Panel’s @-mention completion menu, so `(@file)`, `[@file]`, and
`{@file}` were unusable. This has been bothering me for quite some time
now. Overall, I believe this is a QoL improvement, albeit a small one.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [ ] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [ ] Performance impact has been considered and is acceptable

Release Notes:

- Fixed the Agent Panel’s @-mention menu not appearing when `@`
immediately follows `(`, `[`, or `{`.

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
TomPlanche pushed a commit to TomPlanche/zed that referenced this pull request Jun 2, 2026
…es#55504)

Typing `@` immediately after `(`, `[`, or `{` did not open the Agent
Panel’s @-mention completion menu, so `(@file)`, `[@file]`, and
`{@file}` were unusable. This has been bothering me for quite some time
now. Overall, I believe this is a QoL improvement, albeit a small one.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [ ] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [ ] Performance impact has been considered and is acceptable

Release Notes:

- Fixed the Agent Panel’s @-mention menu not appearing when `@`
immediately follows `(`, `[`, or `{`.

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants