Add experimental LSP-based context retrieval system for edit prediction (#44036)

To do

* [x] Default to no context retrieval. Allow opting in to LSP-based
retrieval via a setting (for users in `zeta2` feature flag)
* [x] Feed this context to models when enabled
* [x] Make the zeta2 context view work well with LSP retrieval
* [x] Add a UI for the setting (for feature-flagged users)
* [x] Ensure Zeta CLI `context` command is usable

---

* [ ] Filter out LSP definitions that are too large / entire files (e.g.
modules)
* [ ] Introduce timeouts
* [ ] Test with other LSPs
* [ ] Figure out hangs

Release Notes:

- N/A

---------

Co-authored-by: Ben Kunkle <ben@zed.dev>
Co-authored-by: Agus Zubiaga <agus@zed.dev>
This commit is contained in:
Max Brunsfeld
2025-12-04 12:48:39 -08:00
committed by GitHub
co-authored by Ben Kunkle Agus Zubiaga
parent cd8679e81a
commit 76167109db
31 changed files with 2478 additions and 1337 deletions
Generated
+27 -1
View File
@@ -5342,6 +5342,32 @@ dependencies = [
"zlog",
]
[[package]]
name = "edit_prediction_context2"
version = "0.1.0"
dependencies = [
"anyhow",
"collections",
"env_logger 0.11.8",
"futures 0.3.31",
"gpui",
"indoc",
"language",
"log",
"lsp",
"parking_lot",
"pretty_assertions",
"project",
"serde",
"serde_json",
"settings",
"smallvec",
"text",
"tree-sitter",
"util",
"zlog",
]
[[package]]
name = "editor"
version = "0.1.0"
@@ -21693,6 +21719,7 @@ dependencies = [
"db",
"edit_prediction",
"edit_prediction_context",
"edit_prediction_context2",
"editor",
"feature_flags",
"fs",
@@ -21742,7 +21769,6 @@ dependencies = [
"clap",
"client",
"cloud_llm_client",
"cloud_zeta2_prompt",
"collections",
"edit_prediction_context",
"editor",