zeta: Only send outline and diagnostics when data collection is enabled (#35896)
This data is not currently used by edit predictions - it is only useful when `can_collect_data == true`. Release Notes: - N/A
This commit is contained in:
parent
a4f7747c73
commit
a1bc6ee75e
2 changed files with 30 additions and 16 deletions
|
@ -1211,7 +1211,7 @@ pub fn gather_context(
|
||||||
let local_lsp_store =
|
let local_lsp_store =
|
||||||
project.and_then(|project| project.read(cx).lsp_store().read(cx).as_local());
|
project.and_then(|project| project.read(cx).lsp_store().read(cx).as_local());
|
||||||
let diagnostic_groups: Vec<(String, serde_json::Value)> =
|
let diagnostic_groups: Vec<(String, serde_json::Value)> =
|
||||||
if let Some(local_lsp_store) = local_lsp_store {
|
if can_collect_data && let Some(local_lsp_store) = local_lsp_store {
|
||||||
snapshot
|
snapshot
|
||||||
.diagnostic_groups(None)
|
.diagnostic_groups(None)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
@ -1245,7 +1245,11 @@ pub fn gather_context(
|
||||||
MAX_CONTEXT_TOKENS,
|
MAX_CONTEXT_TOKENS,
|
||||||
);
|
);
|
||||||
let input_events = make_events_prompt();
|
let input_events = make_events_prompt();
|
||||||
let input_outline = prompt_for_outline(&snapshot);
|
let input_outline = if can_collect_data {
|
||||||
|
prompt_for_outline(&snapshot)
|
||||||
|
} else {
|
||||||
|
String::new()
|
||||||
|
};
|
||||||
let editable_range = input_excerpt.editable_range.to_offset(&snapshot);
|
let editable_range = input_excerpt.editable_range.to_offset(&snapshot);
|
||||||
|
|
||||||
let body = PredictEditsBody {
|
let body = PredictEditsBody {
|
||||||
|
|
|
@ -171,21 +171,31 @@ async fn get_context(
|
||||||
Some(events) => events.read_to_string().await?,
|
Some(events) => events.read_to_string().await?,
|
||||||
None => String::new(),
|
None => String::new(),
|
||||||
};
|
};
|
||||||
let can_collect_data = false;
|
// Enable gathering extra data not currently needed for edit predictions
|
||||||
|
let can_collect_data = true;
|
||||||
let git_info = None;
|
let git_info = None;
|
||||||
cx.update(|cx| {
|
let mut gather_context_output = cx
|
||||||
gather_context(
|
.update(|cx| {
|
||||||
project.as_ref(),
|
gather_context(
|
||||||
full_path_str,
|
project.as_ref(),
|
||||||
&snapshot,
|
full_path_str,
|
||||||
clipped_cursor,
|
&snapshot,
|
||||||
move || events,
|
clipped_cursor,
|
||||||
can_collect_data,
|
move || events,
|
||||||
git_info,
|
can_collect_data,
|
||||||
cx,
|
git_info,
|
||||||
)
|
cx,
|
||||||
})?
|
)
|
||||||
.await
|
})?
|
||||||
|
.await;
|
||||||
|
|
||||||
|
// Disable data collection for these requests, as this is currently just used for evals
|
||||||
|
match gather_context_output.as_mut() {
|
||||||
|
Ok(gather_context_output) => gather_context_output.body.can_collect_data = false,
|
||||||
|
Err(_) => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
gather_context_output
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn open_buffer_with_language_server(
|
pub async fn open_buffer_with_language_server(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue