Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
ep: Limit diagnostic message token counts (#59644)
Ben Kunkle45e84381e23e
diff --git a/crates/edit_prediction/src/zeta.rs b/crates/edit_prediction/src/zeta.rsindex 172726a1d57..013929b3915 100644--- a/crates/edit_prediction/src/zeta.rs+++ b/crates/edit_prediction/src/zeta.rs@@ -567,6 +567,7 @@ fn handle_api_response<T>(const ACTIVE_BUFFER_DIAGNOSTIC_ADDITIONAL_CONTEXT_TOKEN_COUNT: usize = 100;const MAX_ACTIVE_BUFFER_DIAGNOSTICS_TO_COLLECT: usize = 20;+const MAX_ACTIVE_BUFFER_DIAGNOSTIC_MESSAGE_TOKENS_TO_COLLECT: usize = 512;const MAX_ACTIVE_BUFFER_DIAGNOSTIC_SNIPPET_TOKENS_TO_COLLECT: usize = 512;pub(crate) fn active_buffer_diagnostics(@@ -601,7 +602,11 @@ pub(crate) fn active_buffer_diagnostics(};(severity,- entry.diagnostic.message.clone(),+ zeta_prompt::clamp_text_to_token_count(+ &entry.diagnostic.message,+ MAX_ACTIVE_BUFFER_DIAGNOSTIC_MESSAGE_TOKENS_TO_COLLECT,+ )+ .to_string(),diagnostic_point_range,snippet_point_range,)