zed/crates/project/src
Ben Kunkle 7b030b5008
Some checks are pending
Congratsbot / check-author (push) Waiting to run
Congratsbot / congrats (push) Blocked by required conditions
deploy_nightly_docs / deploy_docs (push) Waiting to run
run_tests / orchestrate (push) Waiting to run
run_tests / check_style (push) Waiting to run
run_tests / clippy_windows (push) Blocked by required conditions
run_tests / clippy_linux (push) Blocked by required conditions
run_tests / clippy_mac (push) Blocked by required conditions
run_tests / clippy_mac_x86_64 (push) Blocked by required conditions
run_tests / run_tests_windows (push) Blocked by required conditions
run_tests / run_tests_linux (push) Blocked by required conditions
run_tests / run_tests_mac (push) Blocked by required conditions
run_tests / miri_scheduler (push) Blocked by required conditions
run_tests / doctests (push) Blocked by required conditions
run_tests / check_workspace_binaries (push) Blocked by required conditions
run_tests / build_visual_tests_binary (push) Blocked by required conditions
run_tests / check_wasm (push) Blocked by required conditions
run_tests / check_dependencies (push) Blocked by required conditions
run_tests / check_docs (push) Blocked by required conditions
run_tests / check_licenses (push) Blocked by required conditions
run_tests / check_scripts (push) Blocked by required conditions
run_tests / check_postgres_and_protobuf_migrations (push) Blocked by required conditions
run_tests / extension_tests (push) Blocked by required conditions
run_tests / tests_pass (push) Blocked by required conditions
project: Fix panic when an inlay hint response outlives its buffer version (#61747)
# Objective

Fix a nightly crash where Zed aborts on a bounds-check panic in the
inlay hint cache.

`LspStore::inlay_hints` captures a `RowChunk` before awaiting the
language server, then reads the hint cache with that chunk's id
afterwards. If the buffer shrank meanwhile, `latest_lsp_data` has
already rebuilt the cache with fewer chunks, so the stale id indexes out
of bounds. Chunks are 50 rows, so the reported crash only needed a
~150-250 line deletion, not a drastic edit.

Regressed in #61523. Nightly only; the regressing commit is in no
release tag, so this never reached preview or stable.

Fixes ZED-AGY
Fixes FR-142

## Solution

- Return an empty result when the buffer version no longer matches, so a
stale chunk id can never index the rebuilt cache. The stale *writes*
were already guarded by this version check; only the read sat outside
it.
- An empty result is already treated as "not fetched", so the chunk is
simply re-requested on the next refresh.

## Testing

`test_inlay_hint_response_after_buffer_shrinks` reproduces the abort
deterministically and passes with the fix. Note that it drives the race
through a fake language server rather than a real one.

## Self-Review Checklist:

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

---

Release Notes:

- N/A
2026-07-27 21:04:36 +00:00
..
context_server_store
debugger debugger: Don't eagerly fetch variables for expensive DAP scopes (#61144) 2026-07-17 14:42:46 +00:00
git_store Git partially staged changes (#46541) 2026-07-07 06:55:29 +00:00
lsp_command
lsp_store Properly replace hints per each chunk (#61562) 2026-07-24 09:48:03 +00:00
manifest_tree Split out RelPath into a separate crate (#61029) 2026-07-15 08:33:25 +00:00
agent_registry_store.rs acp: Validate registry agent checksums (#61334) 2026-07-20 13:21:18 +00:00
agent_server_store.rs acp: Validate registry agent checksums (#61334) 2026-07-20 13:21:18 +00:00
bookmark_store.rs Add named bookmark support (#57491) 2026-06-22 20:47:44 +00:00
buffer_store.rs Split out RelPath into a separate crate (#61029) 2026-07-15 08:33:25 +00:00
color_extractor.rs
connection_manager.rs
context_server_store.rs project: Restart context servers when their working directory changes (#61365) 2026-07-22 19:45:18 +00:00
debounced_delay.rs
debugger.rs
environment.rs terminal: Use system shell for non-terminal uses (like spinning up external agents) (#51741) 2026-04-21 08:06:40 +00:00
git_store.rs git_ui: Add option to commit with --no-verify (#61529) 2026-07-23 15:45:21 +00:00
image_store.rs Split out RelPath into a separate crate (#61029) 2026-07-15 08:33:25 +00:00
lsp_command.rs language_core: Remove lsp-types dependency (#61041) 2026-07-15 10:46:01 +00:00
lsp_store.rs project: Fix panic when an inlay hint response outlives its buffer version (#61747) 2026-07-27 21:04:36 +00:00
manifest_tree.rs multi_buffer: Don't eagerly clone BufferSnapshot in range_to_buffer_ranges (#59190) 2026-06-12 12:27:28 +00:00
prettier_store.rs Split out RelPath into a separate crate (#61029) 2026-07-15 08:33:25 +00:00
project.rs project: Track inlay hint / code lens / document symbol registrations by ID (#55340) 2026-07-23 07:53:30 +00:00
project_search.rs Fix text finder crash from unbounded memory use (#60377) 2026-07-06 15:21:32 +00:00
project_settings.rs Disable LSP for files with very long lines (#61447) 2026-07-22 13:25:49 +00:00
search.rs project: Fix include filters being ignored for non-ASCII search in multi-worktree projects (#60538) 2026-07-15 21:15:09 +00:00
search_history.rs Add preview to pickers and make them resizable (#59604) 2026-06-19 17:43:07 +00:00
task_inventory.rs multi_buffer: Don't eagerly clone BufferSnapshot in range_to_buffer_ranges (#59190) 2026-06-12 12:27:28 +00:00
task_store.rs Fix "Run Debugger" failing silently when project does not compile (#52439) 2026-05-04 06:50:38 +00:00
telemetry_snapshot.rs git: Add dev: show git job queue (#55904) 2026-05-07 15:56:32 +00:00
terminals.rs remote: Do not swallow ssh errors (#58780) 2026-06-08 08:48:09 +00:00
toolchain_store.rs Split out RelPath into a separate crate (#61029) 2026-07-15 08:33:25 +00:00
trusted_worktrees.rs Make restricted mode more obvious (#57056) 2026-05-18 16:18:59 +00:00
worktree_store.rs zed: Log worktree info when memory jumps unexpectedly (#61283) 2026-07-19 12:46:31 +00:00
yarn.rs