Skip to content

editor: Introduce Bookmarks#54174

Merged
yara-blue merged 1 commit intomainfrom
bookmarks
Apr 17, 2026
Merged

editor: Introduce Bookmarks#54174
yara-blue merged 1 commit intomainfrom
bookmarks

Conversation

@yara-blue
Copy link
Copy Markdown
Member

Adds basic bookmark functionality to the editor, allowing users to mark lines and later navigate between them. This is an MVP and will later be expanded with a picker, vim marks integration and syntax tree based bookmark positions. In this MVP bookmarks shift under external edits.

UI

Adding/Removing bookmarks

To add a bookmark:

  • run the toggle bookmark action
  • hold secondary and click in the gutter
  • open the context menu by right clicking in the gutter and select add bookmark To remove a bookmark:
  • run the toggle bookmark action
  • click on the bookmarks icon in the gutter
  • open the context menu by right clicking in the gutter and select remove bookmark

remove all bookmarks with workspace: clear bookmarks

Implementation

This mirrors the implementation of breakpoints. The rendering of the gutter was refactored to make place for bookmark icons and buttons:

  • Code was extracted to a Gutter struct
  • Runnables, breakpoints and bookmarks are now collected ahead of layouting. Just before layouting we remove the items that collide and do not have priority.
  • The phantom_breakpoint is replaced by a gutter_hover_button

In depth phantom breakpoint discussion:

This was phantom_breakpoint. It worked as follows:

  • A fake breakpoint was added to the list of breakpoints.
  • While rendering the breakpoints it a breakpoint turned out to be fake it would get a different description and look.
  • The breakpoint list was edited run_indicators ("play buttons") rendering to removes the fake breakpoint if it collided.

This would not scale to more functionality. Now we only render breakpoints, bookmarks and run indicators. Then we render a button if there is not breakpoint, bookmark or run indicator already present. We can do so since the rendering of such "gutter indicators" has been refactored into two phases:

  • collect the items.
  • render them if no higher priority item collides.

This is far easier and more readable which enabled me to easily take the phantom_breakpoint system and use it for placing bookmarks as well :)

Note: this was previously merged but it needed a better squashed commit message. For the actual PR see: 51404. This reverts commit 7e523a2.

Release Notes:

  • Added Bookmarks

Adds basic bookmark functionality to the editor, allowing users to mark lines and later navigate between them. This is an MVP and will later be expanded with a picker, vim marks integration and syntax tree based bookmark positions. In this MVP bookmarks shift under external edits.

# UI
## Adding/Removing bookmarks
To add a bookmark:
- run the toggle bookmark action 
- hold secondary and click in the gutter
- open the context menu by right clicking in the gutter and select add bookmark
To remove a bookmark:
- run the toggle bookmark action 
- click on the bookmarks icon in the gutter
- open the context menu by right clicking in the gutter and select remove bookmark

remove all bookmarks with `workspace: clear bookmarks`


# Implementation
This mirrors the implementation of breakpoints. The rendering of the gutter was refactored to make place for bookmark icons and buttons:
- Code was extracted to a `Gutter` struct
- Runnables, breakpoints and bookmarks are now collected ahead of layouting. Just before layouting we remove the items that collide and do not have priority.
- The `phantom_breakpoint` is replaced by a `gutter_hover_button`

## In depth phantom breakpoint discussion:
This was phantom_breakpoint. It worked as follows:
 - A fake breakpoint was added to the list of breakpoints.
 - While rendering the breakpoints it a breakpoint turned out to be fake
      it would get a different description and look.
 - The breakpoint list was edited run_indicators ("play buttons")
      rendering to removes the fake breakpoint if it collided.

This would not scale to more functionality. Now we only render
breakpoints, bookmarks and run indicators. Then we render a button if
there is not breakpoint, bookmark or run indicator already present. We
can do so since the rendering of such "gutter indicators" has been
refactored into two phases:
 - collect the items.
 - render them if no higher priority item collides.

This is far easier and more readable which enabled me to easily take the
phantom_breakpoint system and use it for placing bookmarks as well :)

Note: this was previously merged but it needed a better squashed commit message. For the actual PR see: 51404. This reverts commit 7e523a2.

Release Notes:

- Added Bookmarks


Co-authored-by: Yara <git@yara.blue>
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Apr 17, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label Apr 17, 2026
This was referenced Apr 17, 2026
@cameron1024
Copy link
Copy Markdown
Contributor

@zed-industries/approved

@yara-blue yara-blue merged commit 73126dc into main Apr 17, 2026
42 checks passed
@yara-blue yara-blue deleted the bookmarks branch April 17, 2026 11:54
eholk added a commit that referenced this pull request Apr 21, 2026
Cherry picks for the next v0.233.x preview release, focused on agent
panel and sidebar fixes and improvements. Built incrementally so CI can
validate as we go.

### Cherry-picked PRs

Listed in the order they were applied (chronological merge order on
`main`). `[x]` = applied on this branch.

- [x] #54055 — sidebar: Move to new workspace non-Wayland
- [x] #54417 — agent_ui: Sort thread import agents by display name
- [x] #54427 — agent_ui: Handle pagination of session/list correctly
when importing
- [x] #54402 — agent_ui: Remove history view
- [x] #54411 — agent_ui: Preserve session resume state after load errors
- [x] #54430 — Remove `AgentV2FeatureFlag`
- [x] #54360 — sidebar: Adjust display of workspaces in header's
ellipsis menu
- [x] #54224 — workspace: Fix recent-projects cleanup wiping active
workspaces
- [x] #54438 — Tweak wording around multi-folder project actions
- [x] #54450 — Close the empty project before adding a project to a
window

### Conflict resolution notes

- **#54402** — `crates/agent_ui/src/agent_panel.rs`: four hunks. The
incoming patch is against a
post-[#47154](#47154) (gpui
`Corner` → `Anchor` rename) tree, which is not on `v0.233.x`. Kept
`Corner` in the `gpui::{...}` import, dropped the now-unused
`DismissEvent` import, removed the `render_recent_entries_menu` function
body and both `.when(show_history_menu && !agent_v2_enabled, ...)` call
sites in the toolbar — so the end state matches what #54402 produces on
`main` modulo the `Corner`/`Anchor` spelling.
- **#54411** — Applied cleanly after #54402 (in the original failed
attempt, a test-helper hunk in `conversation_view.rs` collided with
history-view test code that #54402 removes; ordering #54402 first made
this a no-op).
- **#54430** — Applied cleanly after #54402 (same reason: depends on the
`has_history_for_selected_agent` / `agent_v2_enabled` locals being
gone).
- **#54224** — Applied cleanly, but the new
`recent_projects_picker_workspace` test helper in
`crates/workspace/src/persistence.rs` initializes a `bookmarks:
Default::default()` field on `SerializedWorkspace`. That field comes
from the Bookmarks MVP
([#51404](#51404) /
[#54174](#54174)) which is not
on `v0.233.x`, so we dropped that one line to match the struct shape on
this branch.

Release Notes:

- Fixed unsaved scratch buffers being lost across restarts and an
occasional error when opening a recent project.
([#54224](#54224))

---------

Co-authored-by: Cameron Mcloughlin <cameron.studdstreet@gmail.com>
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
Co-authored-by: allison <28279548+transitoryangel@users.noreply.github.com>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
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.

3 participants