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:
co-authored by
Ben Kunkle
Agus Zubiaga
parent
cd8679e81a
commit
76167109db
@@ -1105,9 +1105,33 @@ impl EditPredictionButton {
|
||||
.separator();
|
||||
}
|
||||
|
||||
let menu = self.build_language_settings_menu(menu, window, cx);
|
||||
let menu = self.add_provider_switching_section(menu, provider, cx);
|
||||
menu = self.build_language_settings_menu(menu, window, cx);
|
||||
|
||||
if cx.has_flag::<Zeta2FeatureFlag>() {
|
||||
let settings = all_language_settings(None, cx);
|
||||
let context_retrieval = settings.edit_predictions.use_context;
|
||||
menu = menu.separator().header("Context Retrieval").item(
|
||||
ContextMenuEntry::new("Enable Context Retrieval")
|
||||
.toggleable(IconPosition::Start, context_retrieval)
|
||||
.action(workspace::ToggleEditPrediction.boxed_clone())
|
||||
.handler({
|
||||
let fs = self.fs.clone();
|
||||
move |_, cx| {
|
||||
update_settings_file(fs.clone(), cx, move |settings, _| {
|
||||
settings
|
||||
.project
|
||||
.all_languages
|
||||
.features
|
||||
.get_or_insert_default()
|
||||
.experimental_edit_prediction_context_retrieval =
|
||||
Some(!context_retrieval)
|
||||
});
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
menu = self.add_provider_switching_section(menu, provider, cx);
|
||||
menu
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user