Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–71 unchanged (71 lines)
72pub mod open_ai_compatible;
73mod zed_edit_prediction_delegate;
74pub mod zeta;
75
76#[cfg(test)]
77mod edit_prediction_tests;
78
79use crate::license_detection::LicenseDetectionWatcher;
80use crate::mercury::Mercury;
81use crate::onboarding_modal::ZedPredictModal;
82pub use crate::prediction::EditPrediction;
83pub use crate::prediction::EditPredictionId;
84use crate::prediction::EditPredictionResult;
…lines 85–494 unchanged (410 lines)
495}
496
497#[derive(Clone)]
498struct PendingSettledPrediction {
499 request_id: EditPredictionId,
500 editable_anchor_range: Range<Anchor>,
501 enqueued_at: Instant,
502 last_edit_at: Instant,
503}
504
505struct RegisteredBuffer {
506 file: Option<Arc<dyn File>>,
507 snapshot: TextBufferSnapshot,
…lines 508–1568 unchanged (1061 lines)
1569 }
1570
1571 telemetry::event!(
1572 EDIT_PREDICTION_SETTLED_EVENT,
1573 request_id = pending_prediction.request_id.0.clone(),
1574 settled_editable_region,
1575 );
1576
1577 return false;
1578 }
1579
1580 if oldest_edited_at
1581 .is_none_or(|t| pending_prediction.last_edit_at < t)
…lines 1582–1596 unchanged (15 lines)
1597 &mut self,
1598 request_id: EditPredictionId,
1599 project: &Entity<Project>,
1600 edited_buffer: &Entity<Buffer>,
1601 edited_buffer_snapshot: &BufferSnapshot,
1602 editable_offset_range: Range<usize>,
1603 cx: &mut Context<Self>,
1604 ) {
1605 let project_state = self.get_or_init_project(project, cx);
1606 if let Some(buffer) = project_state
1607 .registered_buffers
1608 .get_mut(&edited_buffer.entity_id())
1609 {
1610 let now = cx.background_executor().now();
1611 buffer.pending_predictions.push(PendingSettledPrediction {
1612 request_id,
1613 editable_anchor_range: edited_buffer_snapshot
1614 .anchor_range_around(editable_offset_range),
1615 enqueued_at: now,
1616 last_edit_at: now,
1617 });
1618 self.settled_predictions_tx.unbounded_send(now).ok();
1619 }
1620 }
1621
1622 fn reject_current_prediction(
1623 &mut self,
1624 reason: EditPredictionRejectReason,
…lines 1625–2221 unchanged (597 lines)
2222 && related_files.iter().all(|file| file.in_open_source_repo);
2223
2224 let can_collect_data = !cfg!(test)
2225 && is_open_source
2226 && self.is_data_collection_enabled(cx)
2227 && matches!(self.edit_prediction_model, EditPredictionModel::Zeta);
2228
2229 let inputs = EditPredictionModelInput {
2230 project: project.clone(),
2231 buffer: active_buffer.clone(),
2232 snapshot: snapshot,
2233 position,
2234 events,
2235 related_files,
2236 recent_paths: project_state.recent_paths.clone(),
2237 trigger,
2238 diagnostic_search_range: diagnostic_search_range,
2239 debug_tx,
2240 user_actions,
2241 can_collect_data,
2242 is_open_source,
2243 };
2244
2245 if can_collect_data && rand::random_ratio(1, 1000) {
2246 if let Some(task) = capture_example(
2247 project.clone(),
2248 active_buffer,
2249 position,
2250 stored_events,
2251 false,
2252 cx,
2253 ) {
2254 task.detach();
2255 }
2256 }
2257
2258 let task = match self.edit_prediction_model {
2259 EditPredictionModel::Zeta => zeta::request_prediction_with_zeta(self, inputs, cx),
2260 EditPredictionModel::Fim { format } => fim::request_prediction(inputs, format, cx),
2261 EditPredictionModel::Sweep => self.sweep_ai.request_prediction_with_sweep(inputs, cx),
2262 EditPredictionModel::Mercury => self.mercury.request_prediction(inputs, cx),
2263 };
2264
2265 cx.spawn(async move |this, cx| {
…lines 2266–2934 unchanged (669 lines)

After

…lines 1–72 unchanged (72 lines)
73mod zed_edit_prediction_delegate;
74pub mod zeta;
75
76#[cfg(test)]
77mod edit_prediction_tests;
78
79use crate::example_spec::ExampleSpec;
80use crate::license_detection::LicenseDetectionWatcher;
81use crate::mercury::Mercury;
82use crate::onboarding_modal::ZedPredictModal;
83pub use crate::prediction::EditPrediction;
84pub use crate::prediction::EditPredictionId;
85use crate::prediction::EditPredictionResult;
…lines 86–495 unchanged (410 lines)
496}
497
498#[derive(Clone)]
499struct PendingSettledPrediction {
500 request_id: EditPredictionId,
501 editable_anchor_range: Range<Anchor>,
502 example: Option<ExampleSpec>,
503 enqueued_at: Instant,
504 last_edit_at: Instant,
505}
506
507struct RegisteredBuffer {
508 file: Option<Arc<dyn File>>,
…lines 509–1570 unchanged (1062 lines)
1571 }
1572
1573 telemetry::event!(
1574 EDIT_PREDICTION_SETTLED_EVENT,
1575 request_id = pending_prediction.request_id.0.clone(),
1576 settled_editable_region,
1577 example = pending_prediction.example.take(),
1578 );
1579
1580 return false;
1581 }
1582
1583 if oldest_edited_at
…lines 1584–1599 unchanged (16 lines)
1600 &mut self,
1601 request_id: EditPredictionId,
1602 project: &Entity<Project>,
1603 edited_buffer: &Entity<Buffer>,
1604 edited_buffer_snapshot: &BufferSnapshot,
1605 editable_offset_range: Range<usize>,
1606 example: Option<ExampleSpec>,
1607 cx: &mut Context<Self>,
1608 ) {
1609 let this = &mut *self;
1610 let project_state = this.get_or_init_project(project, cx);
1611 if let Some(buffer) = project_state
1612 .registered_buffers
1613 .get_mut(&edited_buffer.entity_id())
1614 {
1615 let now = cx.background_executor().now();
1616 buffer.pending_predictions.push(PendingSettledPrediction {
1617 request_id: request_id,
1618 editable_anchor_range: edited_buffer_snapshot
1619 .anchor_range_around(editable_offset_range),
1620 example,
1621 enqueued_at: now,
1622 last_edit_at: now,
1623 });
1624 this.settled_predictions_tx.unbounded_send(now).ok();
1625 }
1626 }
1627
1628 fn reject_current_prediction(
1629 &mut self,
1630 reason: EditPredictionRejectReason,
…lines 1631–2228 unchanged (598 lines)
2229
2230 let can_collect_data = !cfg!(test)
2231 && is_open_source
2232 && self.is_data_collection_enabled(cx)
2233 && matches!(self.edit_prediction_model, EditPredictionModel::Zeta);
2234
2235 let recent_paths = project_state.recent_paths.clone();
2236
2237 let inputs = EditPredictionModelInput {
2238 project: project.clone(),
2239 buffer: active_buffer,
2240 snapshot,
2241 position,
2242 events,
2243 related_files,
2244 recent_paths,
2245 trigger,
2246 diagnostic_search_range: diagnostic_search_range,
2247 debug_tx,
2248 user_actions,
2249 can_collect_data,
2250 is_open_source,
2251 };
2252
2253 let capture_data = (can_collect_data && rand::random_ratio(1, 1000)).then(|| stored_events);
2254
2255 let task = match self.edit_prediction_model {
2256 EditPredictionModel::Zeta => {
2257 zeta::request_prediction_with_zeta(self, inputs, capture_data, cx)
2258 }
2259 EditPredictionModel::Fim { format } => fim::request_prediction(inputs, format, cx),
2260 EditPredictionModel::Sweep => self.sweep_ai.request_prediction_with_sweep(inputs, cx),
2261 EditPredictionModel::Mercury => self.mercury.request_prediction(inputs, cx),
2262 };
2263
2264 cx.spawn(async move |this, cx| {
…lines 2265–2933 unchanged (669 lines)

Before

source_file
use_declaration
use "use"
scoped_identifier
identifier "anyhow"
:: "::"
identifier "Result"
; ";"
use_declaration
use "use"
scoped_identifier
identifier "arrayvec"
:: "::"
identifier "ArrayVec"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "client"
:: "::"
use_list
{ "{"
identifier "Client"
, ","
identifier "EditPredictionUsage"
, ","
identifier "UserStore"
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "cloud_api_types"
:: "::"
use_list
{ "{"
identifier "OrganizationId"
, ","
identifier "SubmitEditPredictionFeedbackBody"
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
scoped_identifier
identifier "cloud_llm_client"
:: "::"
identifier "predict_edits_v3"
:: "::"
use_list
{ "{"
identifier "PredictEditsV3Request"
, ","
identifier "PredictEditsV3Response"
, ","
identifier "RawCompletionRequest"
, ","
identifier "RawCompletionResponse"
, ","
} "}"
; ";"
use_declaration (+23 nodes collapsed)
use_declaration
use "use"
scoped_use_list
identifier "collections"
:: "::"
use_list
{ "{"
identifier "HashMap"
, ","
identifier "HashSet"
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "copilot"
:: "::"
use_list
{ "{"
identifier "Copilot"
, ","
identifier "Reinstall"
, ","
identifier "SignIn"
, ","
identifier "SignOut"
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
scoped_identifier
identifier "db"
:: "::"
identifier "kvp"
:: "::"
use_list
{ "{"
identifier "Dismissable"
, ","
identifier "KEY_VALUE_STORE"
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "edit_prediction_context"
:: "::"
use_list
{ "{"
identifier "RelatedExcerptStore"
, ","
identifier "RelatedExcerptStoreEvent"
, ","
identifier "RelatedFile"
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "feature_flags"
:: "::"
use_list
{ "{"
identifier "FeatureFlag"
, ","
use_as_clause
identifier "FeatureFlagAppExt"
as "as"
identifier "_"
} "}"
; ";"
use_declaration (+39 nodes collapsed)
use_declaration
use "use"
scoped_identifier
identifier "gpui"
:: "::"
identifier "BackgroundExecutor"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
identifier "gpui"
:: "::"
identifier "http_client"
:: "::"
identifier "Url"
; ";"
use_declaration (+46 nodes collapsed)
use_declaration
use "use"
scoped_identifier
scoped_identifier
identifier "language"
:: "::"
identifier "language_settings"
:: "::"
identifier "all_language_settings"
; ";"
use_declaration (+22 nodes collapsed)
use_declaration
use "use"
scoped_use_list
identifier "language"
:: "::"
use_list
{ "{"
identifier "BufferSnapshot"
, ","
identifier "OffsetRangeExt"
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "language_model"
:: "::"
use_list
{ "{"
identifier "LlmApiToken"
, ","
identifier "NeedsLlmTokenRefresh"
, ","
identifier "RefreshLlmTokenListener"
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "project"
:: "::"
use_list
{ "{"
identifier "DisableAiSettings"
, ","
identifier "Project"
, ","
identifier "ProjectPath"
, ","
identifier "WorktreeId"
} "}"
; ";"
use_declaration
use "use"
scoped_identifier
identifier "release_channel"
:: "::"
identifier "AppVersion"
; ";"
use_declaration
use "use"
scoped_identifier
identifier "semver"
:: "::"
identifier "Version"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
identifier "serde"
:: "::"
identifier "de"
:: "::"
identifier "DeserializeOwned"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "settings"
:: "::"
use_list
{ "{"
identifier "EditPredictionPromptFormat"
, ","
identifier "EditPredictionProvider"
, ","
use_as_clause
identifier "Settings"
as "as"
identifier "_"
, ","
identifier "update_settings_file"
, ","
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
scoped_identifier
identifier "std"
:: "::"
identifier "collections"
:: "::"
use_list
{ "{"
identifier "VecDeque"
, ","
identifier "hash_map"
} "}"
; ";"
use_declaration
use "use"
scoped_identifier
identifier "std"
:: "::"
identifier "env"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "text"
:: "::"
use_list
{ "{"
identifier "AnchorRangeExt"
, ","
identifier "Edit"
} "}"
; ";"
use_declaration
use "use"
scoped_identifier
identifier "workspace"
:: "::"
identifier "Workspace"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "zeta_prompt"
:: "::"
use_list
{ "{"
identifier "ZetaFormat"
, ","
identifier "ZetaPromptInput"
} "}"
; ";"
use_declaration
use "use"
scoped_identifier
identifier "std"
:: "::"
identifier "mem"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "ops"
:: "::"
identifier "Range"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "path"
:: "::"
identifier "Path"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "rc"
:: "::"
identifier "Rc"
; ";"
use_declaration
use "use"
use_as_clause
scoped_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "str"
:: "::"
identifier "FromStr"
as "as"
identifier "_"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "sync"
:: "::"
identifier "Arc"
; ";"
use_declaration
use "use"
scoped_use_list
scoped_identifier
identifier "std"
:: "::"
identifier "time"
:: "::"
use_list
{ "{"
identifier "Duration"
, ","
identifier "Instant"
, ","
identifier "SystemTime"
, ","
identifier "UNIX_EPOCH"
} "}"
; ";"
use_declaration
use "use"
scoped_identifier
identifier "thiserror"
:: "::"
identifier "Error"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "util"
:: "::"
use_list
{ "{"
use_as_clause
identifier "RangeExt"
as "as"
identifier "_"
, ","
use_as_clause
identifier "ResultExt"
as "as"
identifier "_"
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
scoped_identifier
identifier "workspace"
:: "::"
identifier "notifications"
:: "::"
use_list
{ "{"
identifier "ErrorMessagePrompt"
, ","
identifier "NotificationId"
, ","
identifier "show_app_notification"
} "}"
; ";"
mod_item
visibility_modifier
pub "pub"
mod "mod"
identifier "cursor_excerpt"
; ";"
mod_item
visibility_modifier
pub "pub"
mod "mod"
identifier "example_spec"
; ";"
mod_item
visibility_modifier
pub "pub"
mod "mod"
identifier "fim"
; ";"
mod_item
mod "mod"
identifier "license_detection"
; ";"
mod_item
visibility_modifier
pub "pub"
mod "mod"
identifier "mercury"
; ";"
mod_item
visibility_modifier
pub "pub"
mod "mod"
identifier "ollama"
; ";"
mod_item
mod "mod"
identifier "onboarding_modal"
; ";"
mod_item
visibility_modifier
pub "pub"
mod "mod"
identifier "open_ai_response"
; ";"
mod_item
mod "mod"
identifier "prediction"
; ";"
mod_item
visibility_modifier
pub "pub"
mod "mod"
identifier "sweep_ai"
; ";"
mod_item
visibility_modifier
pub "pub"
mod "mod"
identifier "udiff"
; ";"
mod_item
mod "mod"
identifier "capture_example"
; ";"
mod_item
visibility_modifier
pub "pub"
mod "mod"
identifier "open_ai_compatible"
; ";"
mod_item
mod "mod"
identifier "zed_edit_prediction_delegate"
; ";"
mod_item
visibility_modifier
pub "pub"
mod "mod"
identifier "zeta"
; ";"
attribute_item
# "#"
[ "["
attribute
identifier "cfg"
token_tree
( "("
identifier "test"
) ")"
] "]"
mod_item
mod "mod"
identifier "edit_prediction_tests"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
crate "crate"
:: "::"
identifier "license_detection"
:: "::"
identifier "LicenseDetectionWatcher"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
crate "crate"
:: "::"
identifier "mercury"
:: "::"
identifier "Mercury"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
crate "crate"
:: "::"
identifier "onboarding_modal"
:: "::"
identifier "ZedPredictModal"
; ";"
use_declaration
visibility_modifier
pub "pub"
use "use"
scoped_identifier
scoped_identifier
crate "crate"
:: "::"
identifier "prediction"
:: "::"
identifier "EditPrediction"
; ";"
use_declaration
visibility_modifier
pub "pub"
use "use"
scoped_identifier
scoped_identifier
crate "crate"
:: "::"
identifier "prediction"
:: "::"
identifier "EditPredictionId"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
crate "crate"
:: "::"
identifier "prediction"
:: "::"
identifier "EditPredictionResult"
; ";"
use_declaration
visibility_modifier
pub "pub"
use "use"
scoped_identifier
scoped_identifier
crate "crate"
:: "::"
identifier "sweep_ai"
:: "::"
identifier "SweepAi"
; ";"
use_declaration
visibility_modifier
pub "pub"
use "use"
scoped_identifier
identifier "capture_example"
:: "::"
identifier "capture_example"
; ";"
use_declaration
visibility_modifier
pub "pub"
use "use"
scoped_identifier
identifier "language_model"
:: "::"
identifier "ApiKeyState"
; ";"
use_declaration
visibility_modifier
pub "pub"
use "use"
scoped_identifier
identifier "telemetry_events"
:: "::"
identifier "EditPredictionRating"
; ";"
use_declaration
visibility_modifier
pub "pub"
use "use"
scoped_identifier
identifier "zed_edit_prediction_delegate"
:: "::"
identifier "ZedEditPredictionDelegate"
; ";"
expression_statement (+27 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Maximum number of events to track.\n"
const_item
const "const"
identifier "EVENT_COUNT_MAX"
: ":"
primitive_type "usize"
= "="
integer_literal "6"
; ";"
const_item
const "const"
identifier "CHANGE_GROUPING_LINE_SPAN"
: ":"
primitive_type "u32"
= "="
integer_literal "8"
; ";"
const_item
const "const"
identifier "LAST_CHANGE_GROUPING_TIME"
: ":"
type_identifier "Duration"
= "="
call_expression
scoped_identifier
identifier "Duration"
:: "::"
identifier "from_secs"
arguments
( "("
integer_literal "1"
) ")"
; ";"
const_item
const "const"
identifier "ZED_PREDICT_DATA_COLLECTION_CHOICE"
: ":"
reference_type
& "&"
primitive_type "str"
= "="
string_literal
" "\""
string_content "zed_predict_data_collection_choice"
" "\""
; ";"
const_item
const "const"
identifier "REJECT_REQUEST_DEBOUNCE"
: ":"
type_identifier "Duration"
= "="
call_expression
scoped_identifier
identifier "Duration"
:: "::"
identifier "from_secs"
arguments
( "("
integer_literal "15"
) ")"
; ";"
const_item
const "const"
identifier "EDIT_PREDICTION_SETTLED_EVENT"
: ":"
reference_type
& "&"
primitive_type "str"
= "="
string_literal
" "\""
string_content "Edit Prediction Settled"
" "\""
; ";"
const_item
const "const"
identifier "EDIT_PREDICTION_SETTLED_TTL"
: ":"
type_identifier "Duration"
= "="
call_expression
scoped_identifier
identifier "Duration"
:: "::"
identifier "from_secs"
arguments
( "("
binary_expression
integer_literal "60"
* "*"
integer_literal "5"
) ")"
; ";"
const_item
const "const"
identifier "EDIT_PREDICTION_SETTLED_QUIESCENCE"
: ":"
type_identifier "Duration"
= "="
call_expression
scoped_identifier
identifier "Duration"
:: "::"
identifier "from_secs"
arguments
( "("
integer_literal "10"
) ")"
; ";"
struct_item
visibility_modifier
pub "pub"
struct "struct"
type_identifier "EditPredictionJumpsFeatureFlag"
; ";"
impl_item (+24 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Clone"
) ")"
] "]"
struct_item
struct "struct"
type_identifier "EditPredictionStoreGlobal"
ordered_field_declaration_list
( "("
generic_type
type_identifier "Entity"
type_arguments
< "<"
type_identifier "EditPredictionStore"
> ">"
) ")"
; ";"
impl_item
impl "impl"
type_identifier "Global"
for "for"
type_identifier "EditPredictionStoreGlobal"
declaration_list
{ "{"
} "}"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Configuration for using the raw Zeta2 endpoint.\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " When set, the client uses the raw endpoint and constructs t"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " The version is also used as the Baseten environment name (l"...
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Clone"
) ")"
] "]"
struct_item (+39 nodes collapsed)
struct_item (+201 nodes collapsed)
struct_item (+26 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Copy"
, ","
identifier "Clone"
, ","
identifier "PartialEq"
, ","
identifier "Eq"
) ")"
] "]"
enum_item (+27 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Clone"
) ")"
] "]"
struct_item (+131 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
) ")"
] "]"
enum_item (+36 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
) ")"
] "]"
struct_item (+29 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
) ")"
] "]"
struct_item (+44 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
) ")"
] "]"
struct_item (+39 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
) ")"
] "]"
struct_item (+39 nodes collapsed)
const_item
const "const"
identifier "USER_ACTION_HISTORY_SIZE"
: ":"
primitive_type "usize"
= "="
integer_literal "16"
; ";"
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Clone"
, ","
identifier "Debug"
) ")"
] "]"
struct_item (+43 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Clone"
, ","
identifier "Copy"
, ","
identifier "Debug"
, ","
identifier "PartialEq"
, ","
identifier "Eq"
) ")"
] "]"
enum_item (+23 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " An event with associated metadata for reconstructing buffer"...
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Clone"
) ")"
] "]"
struct_item (+42 nodes collapsed)
impl_item (+339 nodes collapsed)
function_item (+107 nodes collapsed)
struct_item (+201 nodes collapsed)
impl_item (+602 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
, ","
identifier "Clone"
) ")"
] "]"
struct_item (+42 nodes collapsed)
impl_item (+319 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
, ","
identifier "Clone"
) ")"
] "]"
enum_item
enum "enum"
type_identifier "PredictionRequestedBy"
enum_variant_list
{ "{"
enum_variant
identifier "DiagnosticsUpdate"
, ","
enum_variant
identifier "Buffer"
ordered_field_declaration_list
( "("
type_identifier "EntityId"
) ")"
, ","
} "}"
impl_item (+63 nodes collapsed)
const_item
const "const"
identifier "DIAGNOSTIC_LINES_RANGE"
: ":"
primitive_type "u32"
= "="
integer_literal "20"
; ";"
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
, ","
identifier "Clone"
, ","
identifier "Copy"
, ","
identifier "PartialEq"
, ","
identifier "Eq"
, ","
identifier "Hash"
) ")"
] "]"
enum_item
visibility_modifier
pub "pub"
enum "enum"
type_identifier "DiagnosticSearchScope"
enum_variant_list
{ "{"
enum_variant
identifier "Local"
, ","
enum_variant
identifier "Global"
, ","
} "}"
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
) ")"
] "]"
struct_item (+41 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " A prediction from the perspective of a buffer.\n"
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
) ")"
] "]"
enum_item (+43 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "cfg"
token_tree
( "("
identifier "test"
) ")"
] "]"
impl_item (+81 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Clone"
) ")"
] "]"
struct_item
struct "struct"
type_identifier "PendingSettledPrediction"
field_declaration_list
{ "{"
field_declaration
field_identifier "request_id"
: ":"
type_identifier "EditPredictionId"
, ","
field_declaration
field_identifier "editable_anchor_range"
: ":"
generic_type
type_identifier "Range"
type_arguments
< "<"
type_identifier "Anchor"
> ">"
, ","
field_declaration
field_identifier "enqueued_at"
: ":"
type_identifier "Instant"
, ","
field_declaration
field_identifier "last_edit_at"
: ":"
type_identifier "Instant"
, ","
} "}"
struct_item (+61 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Clone"
) ")"
] "]"
struct_item (+90 nodes collapsed)
impl_item (+646 nodes collapsed)
function_item (+553 nodes collapsed)
function_item (+119 nodes collapsed)
impl_item
impl "impl"
type_identifier "EditPredictionStore"
declaration_list
{ "{"
function_item (+66 nodes collapsed)
function_item (+170 nodes collapsed)
function_item (+724 nodes collapsed)
function_item (+134 nodes collapsed)
function_item (+29 nodes collapsed)
function_item (+34 nodes collapsed)
function_item (+34 nodes collapsed)
function_item (+34 nodes collapsed)
function_item (+34 nodes collapsed)
function_item (+27 nodes collapsed)
function_item (+573 nodes collapsed)
function_item (+296 nodes collapsed)
function_item (+45 nodes collapsed)
function_item (+45 nodes collapsed)
function_item (+60 nodes collapsed)
function_item (+88 nodes collapsed)
function_item (+90 nodes collapsed)
function_item (+214 nodes collapsed)
function_item (+82 nodes collapsed)
function_item (+301 nodes collapsed)
function_item (+147 nodes collapsed)
function_item (+72 nodes collapsed)
function_item (+53 nodes collapsed)
function_item (+86 nodes collapsed)
function_item (+367 nodes collapsed)
function_item (+50 nodes collapsed)
function_item (+331 nodes collapsed)
function_item (+100 nodes collapsed)
function_item (+323 nodes collapsed)
function_item (+636 nodes collapsed)
function_item (+1205 nodes collapsed)
function_item (+308 nodes collapsed)
function_item (+353 nodes collapsed)
function_item (+467 nodes collapsed)
function_item
function_modifiers
async "async"
fn "fn"
identifier "run_settled_predictions_worker"
parameters (+32 nodes collapsed)
block
{ "{"
let_declaration
let "let"
mutable_specifier "mut"
identifier "next_wake_time"
: ":"
generic_type
type_identifier "Option"
type_arguments
< "<"
type_identifier "Instant"
> ">"
= "="
identifier "None"
; ";"
expression_statement
loop_expression
loop "loop"
block
{ "{"
let_declaration
let "let"
identifier "now"
= "="
call_expression
field_expression
call_expression
field_expression
identifier "cx"
. "."
field_identifier "background_executor"
arguments
( "("
) ")"
. "."
field_identifier "now"
arguments
( "("
) ")"
; ";"
expression_statement (+137 nodes collapsed)
let_declaration (+25 nodes collapsed)
let_declaration
let "let"
identifier "now"
= "="
call_expression
field_expression
call_expression
field_expression
identifier "cx"
. "."
field_identifier "background_executor"
arguments
( "("
) ")"
. "."
field_identifier "now"
arguments
( "("
) ")"
; ";"
let_declaration
let "let"
mutable_specifier "mut"
identifier "oldest_edited_at"
= "="
identifier "None"
; ";"
expression_statement
call_expression
field_expression
identifier "this"
. "."
field_identifier "update"
arguments
( "("
identifier "cx"
, ","
closure_expression
closure_parameters
| "|"
identifier "this"
, ","
_ "_"
| "|"
block
{ "{"
expression_statement
for_expression
for "for"
tuple_pattern
( "("
_ "_"
, ","
identifier "project_state"
) ")"
in "in"
call_expression
field_expression
field_expression
identifier "this"
. "."
field_identifier "projects"
. "."
field_identifier "iter_mut"
arguments
( "("
) ")"
block
{ "{"
expression_statement
for_expression
for "for"
tuple_pattern
( "("
_ "_"
, ","
identifier "registered_buffer"
) ")"
in "in"
call_expression
field_expression
field_expression
identifier "project_state"
. "."
field_identifier "registered_buffers"
. "."
field_identifier "iter_mut"
arguments
( "("
) ")"
block
{ "{"
expression_statement
call_expression
field_expression
field_expression
identifier "registered_buffer"
. "."
field_identifier "pending_predictions"
. "."
field_identifier "retain_mut"
arguments
( "("
closure_expression
closure_parameters
| "|"
identifier "pending_prediction"
| "|"
block
{ "{"
let_declaration
let "let"
identifier "age"
= "="
call_expression
field_expression
identifier "now"
. "."
field_identifier "saturating_duration_since"
arguments
( "("
field_expression
identifier "pending_prediction"
. "."
field_identifier "enqueued_at"
) ")"
; ";"
expression_statement
if_expression
if "if"
binary_expression
identifier "age"
>= ">="
identifier "EDIT_PREDICTION_SETTLED_TTL"
block
{ "{"
expression_statement
return_expression
return "return"
boolean_literal
false "false"
; ";"
} "}"
let_declaration
let "let"
identifier "quiet_for"
= "="
call_expression
field_expression
identifier "now"
. "."
field_identifier "saturating_duration_since"
arguments
( "("
field_expression
identifier "pending_prediction"
. "."
field_identifier "last_edit_at"
) ")"
; ";"
expression_statement
if_expression
if "if"
binary_expression
identifier "quiet_for"
>= ">="
identifier "EDIT_PREDICTION_SETTLED_QUIESCENCE"
block
{ "{"
let_declaration (+41 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "cfg"
token_tree
( "("
identifier "test"
) ")"
] "]"
expression_statement (+48 nodes collapsed)
expression_statement
macro_invocation
scoped_identifier
identifier "telemetry"
:: "::"
identifier "event"
! "!"
token_tree
( "("
identifier "EDIT_PREDICTION_SETTLED_EVENT"
, ","
identifier "request_id"
= "="
identifier "pending_prediction"
. "."
identifier "request_id"
. "."
integer_literal "0"
. "."
identifier "clone"
token_tree
( "("
) ")"
, ","
identifier "settled_editable_region"
, ","
) ")"
; ";"
expression_statement
return_expression
return "return"
boolean_literal
false "false"
; ";"
} "}"
expression_statement (+40 nodes collapsed)
boolean_literal
true "true"
} "}"
) ")"
; ";"
} "}"
} "}"
} "}"
) ")"
; ";"
expression_statement (+22 nodes collapsed)
} "}"
} "}"
function_item
visibility_modifier
pub "pub"
( "("
crate "crate"
) ")"
fn "fn"
identifier "enqueue_settled_prediction"
parameters
( "("
self_parameter
& "&"
mutable_specifier "mut"
self "self"
, ","
parameter
identifier "request_id"
: ":"
type_identifier "EditPredictionId"
, ","
parameter
identifier "project"
: ":"
reference_type
& "&"
generic_type
type_identifier "Entity"
type_arguments
< "<"
type_identifier "Project"
> ">"
, ","
parameter
identifier "edited_buffer"
: ":"
reference_type
& "&"
generic_type
type_identifier "Entity"
type_arguments
< "<"
type_identifier "Buffer"
> ">"
, ","
parameter
identifier "edited_buffer_snapshot"
: ":"
reference_type
& "&"
type_identifier "BufferSnapshot"
, ","
parameter
identifier "editable_offset_range"
: ":"
generic_type
type_identifier "Range"
type_arguments
< "<"
primitive_type "usize"
> ">"
, ","
parameter
identifier "cx"
: ":"
reference_type
& "&"
mutable_specifier "mut"
generic_type
type_identifier "Context"
type_arguments
< "<"
type_identifier "Self"
> ">"
, ","
) ")"
block
{ "{"
let_declaration
let "let"
identifier "project_state"
= "="
call_expression
field_expression
self "self"
. "."
field_identifier "get_or_init_project"
arguments
( "("
identifier "project"
, ","
identifier "cx"
) ")"
; ";"
expression_statement
if_expression
if "if"
let_condition (+29 nodes collapsed)
block
{ "{"
let_declaration
let "let"
identifier "now"
= "="
call_expression
field_expression
call_expression
field_expression
identifier "cx"
. "."
field_identifier "background_executor"
arguments
( "("
) ")"
. "."
field_identifier "now"
arguments
( "("
) ")"
; ";"
expression_statement
call_expression
field_expression
field_expression
identifier "buffer"
. "."
field_identifier "pending_predictions"
. "."
field_identifier "push"
arguments
( "("
struct_expression
type_identifier "PendingSettledPrediction"
field_initializer_list
{ "{"
shorthand_field_initializer
identifier "request_id"
, ","
field_initializer
field_identifier "editable_anchor_range"
: ":"
call_expression
field_expression
identifier "edited_buffer_snapshot"
. "."
field_identifier "anchor_range_around"
arguments
( "("
identifier "editable_offset_range"
) ")"
, ","
field_initializer
field_identifier "enqueued_at"
: ":"
identifier "now"
, ","
field_initializer
field_identifier "last_edit_at"
: ":"
identifier "now"
, ","
} "}"
) ")"
; ";"
expression_statement
call_expression
field_expression
call_expression
field_expression
field_expression
self "self"
. "."
field_identifier "settled_predictions_tx"
. "."
field_identifier "unbounded_send"
arguments
( "("
identifier "now"
) ")"
. "."
field_identifier "ok"
arguments
( "("
) ")"
; ";"
} "}"
} "}"
function_item (+161 nodes collapsed)
function_item (+369 nodes collapsed)
function_item (+271 nodes collapsed)
function_item (+72 nodes collapsed)
function_item (+263 nodes collapsed)
function_item (+764 nodes collapsed)
function_item (+246 nodes collapsed)
const_item
visibility_modifier
pub "pub"
const "const"
identifier "THROTTLE_TIMEOUT"
: ":"
type_identifier "Duration"
= "="
call_expression
scoped_identifier
identifier "Duration"
:: "::"
identifier "from_millis"
arguments
( "("
integer_literal "300"
) ")"
; ";"
} "}"
function_item (+88 nodes collapsed)
impl_item
impl "impl"
type_identifier "EditPredictionStore"
declaration_list
{ "{"
function_item (+1436 nodes collapsed)
function_item (+130 nodes collapsed)
function_item
fn "fn"
identifier "request_prediction_internal"
parameters (+59 nodes collapsed)
-> "->"
generic_type
type_identifier "Task"
type_arguments
< "<"
generic_type
type_identifier "Result"
type_arguments
< "<"
generic_type
type_identifier "Option"
type_arguments
< "<"
type_identifier "EditPredictionResult"
> ">"
> ">"
> ">"
block
{ "{"
expression_statement
call_expression
field_expression
self "self"
. "."
field_identifier "get_or_init_project"
arguments
( "("
reference_expression
& "&"
identifier "project"
, ","
identifier "cx"
) ")"
; ";"
let_declaration (+33 nodes collapsed)
let_declaration
let "let"
identifier "stored_events"
= "="
call_expression
field_expression
identifier "project_state"
. "."
field_identifier "events"
arguments
( "("
identifier "cx"
) ")"
; ";"
let_declaration
let "let"
identifier "has_events"
= "="
unary_expression
! "!"
call_expression
field_expression
identifier "stored_events"
. "."
field_identifier "is_empty"
arguments
( "("
) ")"
; ";"
let_declaration (+58 nodes collapsed)
let_declaration
let "let"
identifier "debug_tx"
= "="
call_expression
field_expression
field_expression
identifier "project_state"
. "."
field_identifier "debug_tx"
. "."
field_identifier "clone"
arguments
( "("
) ")"
; ";"
let_declaration (+21 nodes collapsed)
let_declaration
let "let"
identifier "cursor_point"
= "="
call_expression
field_expression
identifier "position"
. "."
field_identifier "to_point"
arguments
( "("
reference_expression
& "&"
identifier "snapshot"
) ")"
; ";"
let_declaration
let "let"
identifier "current_offset"
= "="
call_expression
field_expression
identifier "position"
. "."
field_identifier "to_offset"
arguments
( "("
reference_expression
& "&"
identifier "snapshot"
) ")"
; ";"
let_declaration (+38 nodes collapsed)
expression_statement (+154 nodes collapsed)
let_declaration
let "let"
identifier "diagnostic_search_start"
= "="
call_expression
field_expression
field_expression
identifier "cursor_point"
. "."
field_identifier "row"
. "."
field_identifier "saturating_sub"
arguments
( "("
identifier "DIAGNOSTIC_LINES_RANGE"
) ")"
; ";"
let_declaration
let "let"
identifier "diagnostic_search_end"
= "="
binary_expression
field_expression
identifier "cursor_point"
. "."
field_identifier "row"
+ "+"
identifier "DIAGNOSTIC_LINES_RANGE"
; ";"
let_declaration (+29 nodes collapsed)
let_declaration
let "let"
identifier "related_files"
= "="
call_expression
field_expression
self "self"
. "."
field_identifier "context_for_project"
arguments
( "("
reference_expression
& "&"
identifier "project"
, ","
identifier "cx"
) ")"
; ";"
let_declaration (+99 nodes collapsed)
let_declaration (+43 nodes collapsed)
let_declaration
let "let"
identifier "inputs"
= "="
struct_expression
type_identifier "EditPredictionModelInput"
field_initializer_list
{ "{"
field_initializer
field_identifier "project"
: ":"
call_expression
field_expression
identifier "project"
. "."
field_identifier "clone"
arguments
( "("
) ")"
, ","
field_initializer
field_identifier "buffer"
: ":"
call_expression
field_expression
identifier "active_buffer"
. "."
field_identifier "clone"
arguments
( "("
) ")"
, ","
field_initializer
field_identifier "snapshot"
: ":"
identifier "snapshot"
, ","
shorthand_field_initializer
identifier "position"
, ","
shorthand_field_initializer
identifier "events"
, ","
shorthand_field_initializer
identifier "related_files"
, ","
field_initializer
field_identifier "recent_paths"
: ":"
call_expression
field_expression
field_expression
identifier "project_state"
. "."
field_identifier "recent_paths"
. "."
field_identifier "clone"
arguments
( "("
) ")"
, ","
shorthand_field_initializer
identifier "trigger"
, ","
field_initializer
field_identifier "diagnostic_search_range"
: ":"
identifier "diagnostic_search_range"
, ","
shorthand_field_initializer
identifier "debug_tx"
, ","
shorthand_field_initializer
identifier "user_actions"
, ","
shorthand_field_initializer
identifier "can_collect_data"
, ","
shorthand_field_initializer
identifier "is_open_source"
, ","
} "}"
; ";"
expression_statement
if_expression
if "if"
binary_expression
identifier "can_collect_data"
&& "&&"
call_expression
scoped_identifier
identifier "rand"
:: "::"
identifier "random_ratio"
arguments
( "("
integer_literal "1"
, ","
integer_literal "1000"
) ")"
block
{ "{"
expression_statement
if_expression
if "if"
let_condition
let "let"
tuple_struct_pattern
identifier "Some"
( "("
identifier "task"
) ")"
= "="
call_expression
identifier "capture_example"
arguments
( "("
call_expression
field_expression
identifier "project"
. "."
field_identifier "clone"
arguments
( "("
) ")"
, ","
identifier "active_buffer"
, ","
identifier "position"
, ","
identifier "stored_events"
, ","
boolean_literal
false "false"
, ","
identifier "cx"
, ","
) ")"
block
{ "{"
expression_statement
call_expression
field_expression
identifier "task"
. "."
field_identifier "detach"
arguments
( "("
) ")"
; ";"
} "}"
} "}"
let_declaration
let "let"
identifier "task"
= "="
match_expression
match "match"
field_expression
self "self"
. "."
field_identifier "edit_prediction_model"
match_block
{ "{"
match_arm
match_pattern
scoped_identifier
identifier "EditPredictionModel"
:: "::"
identifier "Zeta"
=> "=>"
call_expression
scoped_identifier
identifier "zeta"
:: "::"
identifier "request_prediction_with_zeta"
arguments
( "("
self "self"
, ","
identifier "inputs"
, ","
identifier "cx"
) ")"
, ","
match_arm (+26 nodes collapsed)
match_arm (+22 nodes collapsed)
match_arm (+22 nodes collapsed)
} "}"
; ";"
call_expression (+132 nodes collapsed)
} "}"
function_item (+1043 nodes collapsed)
function_item (+231 nodes collapsed)
function_item (+261 nodes collapsed)
function_item (+375 nodes collapsed)
function_item (+720 nodes collapsed)
function_item (+121 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "cfg"
token_tree
( "("
identifier "feature"
= "="
string_literal
" "\""
string_content "cli-support"
" "\""
) ")"
] "]"
function_item (+99 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "cfg"
token_tree
( "("
identifier "feature"
= "="
string_literal
" "\""
string_content "cli-support"
" "\""
) ")"
] "]"
function_item (+98 nodes collapsed)
function_item (+169 nodes collapsed)
function_item (+38 nodes collapsed)
function_item (+124 nodes collapsed)
function_item (+114 nodes collapsed)
function_item (+39 nodes collapsed)
function_item (+27 nodes collapsed)
function_item (+35 nodes collapsed)
function_item (+349 nodes collapsed)
} "}"
function_item (+539 nodes collapsed)
function_item (+159 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Error"
, ","
identifier "Debug"
) ")"
] "]"
attribute_item
# "#"
[ "["
attribute
identifier "error"
token_tree
( "("
string_literal
" "\""
string_content "You must update to Zed version {minimum_version} or higher t"...
" "\""
) ")"
] "]"
struct_item
visibility_modifier
pub "pub"
struct "struct"
type_identifier "ZedUpdateRequiredError"
field_declaration_list
{ "{"
field_declaration
field_identifier "minimum_version"
: ":"
type_identifier "Version"
, ","
} "}"
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
, ","
identifier "Clone"
, ","
identifier "Copy"
) ")"
] "]"
enum_item
visibility_modifier
pub "pub"
enum "enum"
type_identifier "DataCollectionChoice"
enum_variant_list
{ "{"
enum_variant
identifier "NotAnswered"
, ","
enum_variant
identifier "Enabled"
, ","
enum_variant
identifier "Disabled"
, ","
} "}"
impl_item (+146 nodes collapsed)
impl_item (+55 nodes collapsed)
struct_item
struct "struct"
type_identifier "ZedPredictUpsell"
; ";"
impl_item (+130 nodes collapsed)
function_item (+23 nodes collapsed)
function_item (+544 nodes collapsed)

After

source_file
use_declaration
use "use"
scoped_identifier
identifier "anyhow"
:: "::"
identifier "Result"
; ";"
use_declaration
use "use"
scoped_identifier
identifier "arrayvec"
:: "::"
identifier "ArrayVec"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "client"
:: "::"
use_list
{ "{"
identifier "Client"
, ","
identifier "EditPredictionUsage"
, ","
identifier "UserStore"
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "cloud_api_types"
:: "::"
use_list
{ "{"
identifier "OrganizationId"
, ","
identifier "SubmitEditPredictionFeedbackBody"
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
scoped_identifier
identifier "cloud_llm_client"
:: "::"
identifier "predict_edits_v3"
:: "::"
use_list
{ "{"
identifier "PredictEditsV3Request"
, ","
identifier "PredictEditsV3Response"
, ","
identifier "RawCompletionRequest"
, ","
identifier "RawCompletionResponse"
, ","
} "}"
; ";"
use_declaration (+23 nodes collapsed)
use_declaration
use "use"
scoped_use_list
identifier "collections"
:: "::"
use_list
{ "{"
identifier "HashMap"
, ","
identifier "HashSet"
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "copilot"
:: "::"
use_list
{ "{"
identifier "Copilot"
, ","
identifier "Reinstall"
, ","
identifier "SignIn"
, ","
identifier "SignOut"
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
scoped_identifier
identifier "db"
:: "::"
identifier "kvp"
:: "::"
use_list
{ "{"
identifier "Dismissable"
, ","
identifier "KEY_VALUE_STORE"
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "edit_prediction_context"
:: "::"
use_list
{ "{"
identifier "RelatedExcerptStore"
, ","
identifier "RelatedExcerptStoreEvent"
, ","
identifier "RelatedFile"
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "feature_flags"
:: "::"
use_list
{ "{"
identifier "FeatureFlag"
, ","
use_as_clause
identifier "FeatureFlagAppExt"
as "as"
identifier "_"
} "}"
; ";"
use_declaration (+39 nodes collapsed)
use_declaration
use "use"
scoped_identifier
identifier "gpui"
:: "::"
identifier "BackgroundExecutor"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
identifier "gpui"
:: "::"
identifier "http_client"
:: "::"
identifier "Url"
; ";"
use_declaration (+46 nodes collapsed)
use_declaration
use "use"
scoped_identifier
scoped_identifier
identifier "language"
:: "::"
identifier "language_settings"
:: "::"
identifier "all_language_settings"
; ";"
use_declaration (+22 nodes collapsed)
use_declaration
use "use"
scoped_use_list
identifier "language"
:: "::"
use_list
{ "{"
identifier "BufferSnapshot"
, ","
identifier "OffsetRangeExt"
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "language_model"
:: "::"
use_list
{ "{"
identifier "LlmApiToken"
, ","
identifier "NeedsLlmTokenRefresh"
, ","
identifier "RefreshLlmTokenListener"
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "project"
:: "::"
use_list
{ "{"
identifier "DisableAiSettings"
, ","
identifier "Project"
, ","
identifier "ProjectPath"
, ","
identifier "WorktreeId"
} "}"
; ";"
use_declaration
use "use"
scoped_identifier
identifier "release_channel"
:: "::"
identifier "AppVersion"
; ";"
use_declaration
use "use"
scoped_identifier
identifier "semver"
:: "::"
identifier "Version"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
identifier "serde"
:: "::"
identifier "de"
:: "::"
identifier "DeserializeOwned"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "settings"
:: "::"
use_list
{ "{"
identifier "EditPredictionPromptFormat"
, ","
identifier "EditPredictionProvider"
, ","
use_as_clause
identifier "Settings"
as "as"
identifier "_"
, ","
identifier "update_settings_file"
, ","
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
scoped_identifier
identifier "std"
:: "::"
identifier "collections"
:: "::"
use_list
{ "{"
identifier "VecDeque"
, ","
identifier "hash_map"
} "}"
; ";"
use_declaration
use "use"
scoped_identifier
identifier "std"
:: "::"
identifier "env"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "text"
:: "::"
use_list
{ "{"
identifier "AnchorRangeExt"
, ","
identifier "Edit"
} "}"
; ";"
use_declaration
use "use"
scoped_identifier
identifier "workspace"
:: "::"
identifier "Workspace"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "zeta_prompt"
:: "::"
use_list
{ "{"
identifier "ZetaFormat"
, ","
identifier "ZetaPromptInput"
} "}"
; ";"
use_declaration
use "use"
scoped_identifier
identifier "std"
:: "::"
identifier "mem"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "ops"
:: "::"
identifier "Range"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "path"
:: "::"
identifier "Path"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "rc"
:: "::"
identifier "Rc"
; ";"
use_declaration
use "use"
use_as_clause
scoped_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "str"
:: "::"
identifier "FromStr"
as "as"
identifier "_"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "sync"
:: "::"
identifier "Arc"
; ";"
use_declaration
use "use"
scoped_use_list
scoped_identifier
identifier "std"
:: "::"
identifier "time"
:: "::"
use_list
{ "{"
identifier "Duration"
, ","
identifier "Instant"
, ","
identifier "SystemTime"
, ","
identifier "UNIX_EPOCH"
} "}"
; ";"
use_declaration
use "use"
scoped_identifier
identifier "thiserror"
:: "::"
identifier "Error"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "util"
:: "::"
use_list
{ "{"
use_as_clause
identifier "RangeExt"
as "as"
identifier "_"
, ","
use_as_clause
identifier "ResultExt"
as "as"
identifier "_"
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
scoped_identifier
identifier "workspace"
:: "::"
identifier "notifications"
:: "::"
use_list
{ "{"
identifier "ErrorMessagePrompt"
, ","
identifier "NotificationId"
, ","
identifier "show_app_notification"
} "}"
; ";"
mod_item
visibility_modifier
pub "pub"
mod "mod"
identifier "cursor_excerpt"
; ";"
mod_item
visibility_modifier
pub "pub"
mod "mod"
identifier "example_spec"
; ";"
mod_item
visibility_modifier
pub "pub"
mod "mod"
identifier "fim"
; ";"
mod_item
mod "mod"
identifier "license_detection"
; ";"
mod_item
visibility_modifier
pub "pub"
mod "mod"
identifier "mercury"
; ";"
mod_item
visibility_modifier
pub "pub"
mod "mod"
identifier "ollama"
; ";"
mod_item
mod "mod"
identifier "onboarding_modal"
; ";"
mod_item
visibility_modifier
pub "pub"
mod "mod"
identifier "open_ai_response"
; ";"
mod_item
mod "mod"
identifier "prediction"
; ";"
mod_item
visibility_modifier
pub "pub"
mod "mod"
identifier "sweep_ai"
; ";"
mod_item
visibility_modifier
pub "pub"
mod "mod"
identifier "udiff"
; ";"
mod_item
mod "mod"
identifier "capture_example"
; ";"
mod_item
visibility_modifier
pub "pub"
mod "mod"
identifier "open_ai_compatible"
; ";"
mod_item
mod "mod"
identifier "zed_edit_prediction_delegate"
; ";"
mod_item
visibility_modifier
pub "pub"
mod "mod"
identifier "zeta"
; ";"
attribute_item
# "#"
[ "["
attribute
identifier "cfg"
token_tree
( "("
identifier "test"
) ")"
] "]"
mod_item
mod "mod"
identifier "edit_prediction_tests"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
crate "crate"
:: "::"
identifier "example_spec"
:: "::"
identifier "ExampleSpec"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
crate "crate"
:: "::"
identifier "license_detection"
:: "::"
identifier "LicenseDetectionWatcher"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
crate "crate"
:: "::"
identifier "mercury"
:: "::"
identifier "Mercury"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
crate "crate"
:: "::"
identifier "onboarding_modal"
:: "::"
identifier "ZedPredictModal"
; ";"
use_declaration
visibility_modifier
pub "pub"
use "use"
scoped_identifier
scoped_identifier
crate "crate"
:: "::"
identifier "prediction"
:: "::"
identifier "EditPrediction"
; ";"
use_declaration
visibility_modifier
pub "pub"
use "use"
scoped_identifier
scoped_identifier
crate "crate"
:: "::"
identifier "prediction"
:: "::"
identifier "EditPredictionId"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
crate "crate"
:: "::"
identifier "prediction"
:: "::"
identifier "EditPredictionResult"
; ";"
use_declaration
visibility_modifier
pub "pub"
use "use"
scoped_identifier
scoped_identifier
crate "crate"
:: "::"
identifier "sweep_ai"
:: "::"
identifier "SweepAi"
; ";"
use_declaration
visibility_modifier
pub "pub"
use "use"
scoped_identifier
identifier "capture_example"
:: "::"
identifier "capture_example"
; ";"
use_declaration
visibility_modifier
pub "pub"
use "use"
scoped_identifier
identifier "language_model"
:: "::"
identifier "ApiKeyState"
; ";"
use_declaration
visibility_modifier
pub "pub"
use "use"
scoped_identifier
identifier "telemetry_events"
:: "::"
identifier "EditPredictionRating"
; ";"
use_declaration
visibility_modifier
pub "pub"
use "use"
scoped_identifier
identifier "zed_edit_prediction_delegate"
:: "::"
identifier "ZedEditPredictionDelegate"
; ";"
expression_statement (+27 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Maximum number of events to track.\n"
const_item
const "const"
identifier "EVENT_COUNT_MAX"
: ":"
primitive_type "usize"
= "="
integer_literal "6"
; ";"
const_item
const "const"
identifier "CHANGE_GROUPING_LINE_SPAN"
: ":"
primitive_type "u32"
= "="
integer_literal "8"
; ";"
const_item
const "const"
identifier "LAST_CHANGE_GROUPING_TIME"
: ":"
type_identifier "Duration"
= "="
call_expression
scoped_identifier
identifier "Duration"
:: "::"
identifier "from_secs"
arguments
( "("
integer_literal "1"
) ")"
; ";"
const_item
const "const"
identifier "ZED_PREDICT_DATA_COLLECTION_CHOICE"
: ":"
reference_type
& "&"
primitive_type "str"
= "="
string_literal
" "\""
string_content "zed_predict_data_collection_choice"
" "\""
; ";"
const_item
const "const"
identifier "REJECT_REQUEST_DEBOUNCE"
: ":"
type_identifier "Duration"
= "="
call_expression
scoped_identifier
identifier "Duration"
:: "::"
identifier "from_secs"
arguments
( "("
integer_literal "15"
) ")"
; ";"
const_item
const "const"
identifier "EDIT_PREDICTION_SETTLED_EVENT"
: ":"
reference_type
& "&"
primitive_type "str"
= "="
string_literal
" "\""
string_content "Edit Prediction Settled"
" "\""
; ";"
const_item
const "const"
identifier "EDIT_PREDICTION_SETTLED_TTL"
: ":"
type_identifier "Duration"
= "="
call_expression
scoped_identifier
identifier "Duration"
:: "::"
identifier "from_secs"
arguments
( "("
binary_expression
integer_literal "60"
* "*"
integer_literal "5"
) ")"
; ";"
const_item
const "const"
identifier "EDIT_PREDICTION_SETTLED_QUIESCENCE"
: ":"
type_identifier "Duration"
= "="
call_expression
scoped_identifier
identifier "Duration"
:: "::"
identifier "from_secs"
arguments
( "("
integer_literal "10"
) ")"
; ";"
struct_item
visibility_modifier
pub "pub"
struct "struct"
type_identifier "EditPredictionJumpsFeatureFlag"
; ";"
impl_item (+24 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Clone"
) ")"
] "]"
struct_item
struct "struct"
type_identifier "EditPredictionStoreGlobal"
ordered_field_declaration_list
( "("
generic_type
type_identifier "Entity"
type_arguments
< "<"
type_identifier "EditPredictionStore"
> ">"
) ")"
; ";"
impl_item
impl "impl"
type_identifier "Global"
for "for"
type_identifier "EditPredictionStoreGlobal"
declaration_list
{ "{"
} "}"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Configuration for using the raw Zeta2 endpoint.\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " When set, the client uses the raw endpoint and constructs t"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " The version is also used as the Baseten environment name (l"...
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Clone"
) ")"
] "]"
struct_item (+39 nodes collapsed)
struct_item (+201 nodes collapsed)
struct_item (+26 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Copy"
, ","
identifier "Clone"
, ","
identifier "PartialEq"
, ","
identifier "Eq"
) ")"
] "]"
enum_item (+27 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Clone"
) ")"
] "]"
struct_item (+131 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
) ")"
] "]"
enum_item (+36 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
) ")"
] "]"
struct_item (+29 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
) ")"
] "]"
struct_item (+44 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
) ")"
] "]"
struct_item (+39 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
) ")"
] "]"
struct_item (+39 nodes collapsed)
const_item
const "const"
identifier "USER_ACTION_HISTORY_SIZE"
: ":"
primitive_type "usize"
= "="
integer_literal "16"
; ";"
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Clone"
, ","
identifier "Debug"
) ")"
] "]"
struct_item (+43 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Clone"
, ","
identifier "Copy"
, ","
identifier "Debug"
, ","
identifier "PartialEq"
, ","
identifier "Eq"
) ")"
] "]"
enum_item (+23 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " An event with associated metadata for reconstructing buffer"...
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Clone"
) ")"
] "]"
struct_item (+42 nodes collapsed)
impl_item (+339 nodes collapsed)
function_item (+107 nodes collapsed)
struct_item (+201 nodes collapsed)
impl_item (+602 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
, ","
identifier "Clone"
) ")"
] "]"
struct_item (+42 nodes collapsed)
impl_item (+319 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
, ","
identifier "Clone"
) ")"
] "]"
enum_item
enum "enum"
type_identifier "PredictionRequestedBy"
enum_variant_list
{ "{"
enum_variant
identifier "DiagnosticsUpdate"
, ","
enum_variant
identifier "Buffer"
ordered_field_declaration_list
( "("
type_identifier "EntityId"
) ")"
, ","
} "}"
impl_item (+63 nodes collapsed)
const_item
const "const"
identifier "DIAGNOSTIC_LINES_RANGE"
: ":"
primitive_type "u32"
= "="
integer_literal "20"
; ";"
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
, ","
identifier "Clone"
, ","
identifier "Copy"
, ","
identifier "PartialEq"
, ","
identifier "Eq"
, ","
identifier "Hash"
) ")"
] "]"
enum_item
visibility_modifier
pub "pub"
enum "enum"
type_identifier "DiagnosticSearchScope"
enum_variant_list
{ "{"
enum_variant
identifier "Local"
, ","
enum_variant
identifier "Global"
, ","
} "}"
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
) ")"
] "]"
struct_item (+41 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " A prediction from the perspective of a buffer.\n"
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
) ")"
] "]"
enum_item (+43 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "cfg"
token_tree
( "("
identifier "test"
) ")"
] "]"
impl_item (+81 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Clone"
) ")"
] "]"
struct_item
struct "struct"
type_identifier "PendingSettledPrediction"
field_declaration_list
{ "{"
field_declaration
field_identifier "request_id"
: ":"
type_identifier "EditPredictionId"
, ","
field_declaration
field_identifier "editable_anchor_range"
: ":"
generic_type
type_identifier "Range"
type_arguments
< "<"
type_identifier "Anchor"
> ">"
, ","
field_declaration
field_identifier "example"
: ":"
generic_type
type_identifier "Option"
type_arguments
< "<"
type_identifier "ExampleSpec"
> ">"
, ","
field_declaration
field_identifier "enqueued_at"
: ":"
type_identifier "Instant"
, ","
field_declaration
field_identifier "last_edit_at"
: ":"
type_identifier "Instant"
, ","
} "}"
struct_item (+61 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Clone"
) ")"
] "]"
struct_item (+90 nodes collapsed)
impl_item (+646 nodes collapsed)
function_item (+553 nodes collapsed)
function_item (+119 nodes collapsed)
impl_item
impl "impl"
type_identifier "EditPredictionStore"
declaration_list
{ "{"
function_item (+66 nodes collapsed)
function_item (+170 nodes collapsed)
function_item (+724 nodes collapsed)
function_item (+134 nodes collapsed)
function_item (+29 nodes collapsed)
function_item (+34 nodes collapsed)
function_item (+34 nodes collapsed)
function_item (+34 nodes collapsed)
function_item (+34 nodes collapsed)
function_item (+27 nodes collapsed)
function_item (+573 nodes collapsed)
function_item (+296 nodes collapsed)
function_item (+45 nodes collapsed)
function_item (+45 nodes collapsed)
function_item (+60 nodes collapsed)
function_item (+88 nodes collapsed)
function_item (+90 nodes collapsed)
function_item (+214 nodes collapsed)
function_item (+82 nodes collapsed)
function_item (+301 nodes collapsed)
function_item (+147 nodes collapsed)
function_item (+72 nodes collapsed)
function_item (+53 nodes collapsed)
function_item (+86 nodes collapsed)
function_item (+367 nodes collapsed)
function_item (+50 nodes collapsed)
function_item (+331 nodes collapsed)
function_item (+100 nodes collapsed)
function_item (+323 nodes collapsed)
function_item (+636 nodes collapsed)
function_item (+1205 nodes collapsed)
function_item (+308 nodes collapsed)
function_item (+353 nodes collapsed)
function_item (+467 nodes collapsed)
function_item
function_modifiers
async "async"
fn "fn"
identifier "run_settled_predictions_worker"
parameters (+32 nodes collapsed)
block
{ "{"
let_declaration
let "let"
mutable_specifier "mut"
identifier "next_wake_time"
: ":"
generic_type
type_identifier "Option"
type_arguments
< "<"
type_identifier "Instant"
> ">"
= "="
identifier "None"
; ";"
expression_statement
loop_expression
loop "loop"
block
{ "{"
let_declaration
let "let"
identifier "now"
= "="
call_expression
field_expression
call_expression
field_expression
identifier "cx"
. "."
field_identifier "background_executor"
arguments
( "("
) ")"
. "."
field_identifier "now"
arguments
( "("
) ")"
; ";"
expression_statement (+137 nodes collapsed)
let_declaration (+25 nodes collapsed)
let_declaration
let "let"
identifier "now"
= "="
call_expression
field_expression
call_expression
field_expression
identifier "cx"
. "."
field_identifier "background_executor"
arguments
( "("
) ")"
. "."
field_identifier "now"
arguments
( "("
) ")"
; ";"
let_declaration
let "let"
mutable_specifier "mut"
identifier "oldest_edited_at"
= "="
identifier "None"
; ";"
expression_statement
call_expression
field_expression
identifier "this"
. "."
field_identifier "update"
arguments
( "("
identifier "cx"
, ","
closure_expression
closure_parameters
| "|"
identifier "this"
, ","
_ "_"
| "|"
block
{ "{"
expression_statement
for_expression
for "for"
tuple_pattern
( "("
_ "_"
, ","
identifier "project_state"
) ")"
in "in"
call_expression
field_expression
field_expression
identifier "this"
. "."
field_identifier "projects"
. "."
field_identifier "iter_mut"
arguments
( "("
) ")"
block
{ "{"
expression_statement
for_expression
for "for"
tuple_pattern
( "("
_ "_"
, ","
identifier "registered_buffer"
) ")"
in "in"
call_expression
field_expression
field_expression
identifier "project_state"
. "."
field_identifier "registered_buffers"
. "."
field_identifier "iter_mut"
arguments
( "("
) ")"
block
{ "{"
expression_statement
call_expression
field_expression
field_expression
identifier "registered_buffer"
. "."
field_identifier "pending_predictions"
. "."
field_identifier "retain_mut"
arguments
( "("
closure_expression
closure_parameters
| "|"
identifier "pending_prediction"
| "|"
block
{ "{"
let_declaration
let "let"
identifier "age"
= "="
call_expression
field_expression
identifier "now"
. "."
field_identifier "saturating_duration_since"
arguments
( "("
field_expression
identifier "pending_prediction"
. "."
field_identifier "enqueued_at"
) ")"
; ";"
expression_statement
if_expression
if "if"
binary_expression
identifier "age"
>= ">="
identifier "EDIT_PREDICTION_SETTLED_TTL"
block
{ "{"
expression_statement
return_expression
return "return"
boolean_literal
false "false"
; ";"
} "}"
let_declaration
let "let"
identifier "quiet_for"
= "="
call_expression
field_expression
identifier "now"
. "."
field_identifier "saturating_duration_since"
arguments
( "("
field_expression
identifier "pending_prediction"
. "."
field_identifier "last_edit_at"
) ")"
; ";"
expression_statement
if_expression
if "if"
binary_expression
identifier "quiet_for"
>= ">="
identifier "EDIT_PREDICTION_SETTLED_QUIESCENCE"
block
{ "{"
let_declaration (+41 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "cfg"
token_tree
( "("
identifier "test"
) ")"
] "]"
expression_statement (+48 nodes collapsed)
expression_statement
macro_invocation
scoped_identifier
identifier "telemetry"
:: "::"
identifier "event"
! "!"
token_tree
( "("
identifier "EDIT_PREDICTION_SETTLED_EVENT"
, ","
identifier "request_id"
= "="
identifier "pending_prediction"
. "."
identifier "request_id"
. "."
integer_literal "0"
. "."
identifier "clone"
token_tree
( "("
) ")"
, ","
identifier "settled_editable_region"
, ","
identifier "example"
= "="
identifier "pending_prediction"
. "."
identifier "example"
. "."
identifier "take"
token_tree
( "("
) ")"
, ","
) ")"
; ";"
expression_statement
return_expression
return "return"
boolean_literal
false "false"
; ";"
} "}"
expression_statement (+40 nodes collapsed)
boolean_literal
true "true"
} "}"
) ")"
; ";"
} "}"
} "}"
} "}"
) ")"
; ";"
expression_statement (+22 nodes collapsed)
} "}"
} "}"
function_item
visibility_modifier
pub "pub"
( "("
crate "crate"
) ")"
fn "fn"
identifier "enqueue_settled_prediction"
parameters
( "("
self_parameter
& "&"
mutable_specifier "mut"
self "self"
, ","
parameter
identifier "request_id"
: ":"
type_identifier "EditPredictionId"
, ","
parameter
identifier "project"
: ":"
reference_type
& "&"
generic_type
type_identifier "Entity"
type_arguments
< "<"
type_identifier "Project"
> ">"
, ","
parameter
identifier "edited_buffer"
: ":"
reference_type
& "&"
generic_type
type_identifier "Entity"
type_arguments
< "<"
type_identifier "Buffer"
> ">"
, ","
parameter
identifier "edited_buffer_snapshot"
: ":"
reference_type
& "&"
type_identifier "BufferSnapshot"
, ","
parameter
identifier "editable_offset_range"
: ":"
generic_type
type_identifier "Range"
type_arguments
< "<"
primitive_type "usize"
> ">"
, ","
parameter
identifier "example"
: ":"
generic_type
type_identifier "Option"
type_arguments
< "<"
type_identifier "ExampleSpec"
> ">"
, ","
parameter
identifier "cx"
: ":"
reference_type
& "&"
mutable_specifier "mut"
generic_type
type_identifier "Context"
type_arguments
< "<"
type_identifier "Self"
> ">"
, ","
) ")"
block
{ "{"
let_declaration
let "let"
identifier "this"
= "="
reference_expression
& "&"
mutable_specifier "mut"
unary_expression
* "*"
self "self"
; ";"
let_declaration
let "let"
identifier "project_state"
= "="
call_expression
field_expression
identifier "this"
. "."
field_identifier "get_or_init_project"
arguments
( "("
identifier "project"
, ","
identifier "cx"
) ")"
; ";"
expression_statement
if_expression
if "if"
let_condition (+29 nodes collapsed)
block
{ "{"
let_declaration
let "let"
identifier "now"
= "="
call_expression
field_expression
call_expression
field_expression
identifier "cx"
. "."
field_identifier "background_executor"
arguments
( "("
) ")"
. "."
field_identifier "now"
arguments
( "("
) ")"
; ";"
expression_statement
call_expression
field_expression
field_expression
identifier "buffer"
. "."
field_identifier "pending_predictions"
. "."
field_identifier "push"
arguments
( "("
struct_expression
type_identifier "PendingSettledPrediction"
field_initializer_list
{ "{"
field_initializer
field_identifier "request_id"
: ":"
identifier "request_id"
, ","
field_initializer
field_identifier "editable_anchor_range"
: ":"
call_expression
field_expression
identifier "edited_buffer_snapshot"
. "."
field_identifier "anchor_range_around"
arguments
( "("
identifier "editable_offset_range"
) ")"
, ","
shorthand_field_initializer
identifier "example"
, ","
field_initializer
field_identifier "enqueued_at"
: ":"
identifier "now"
, ","
field_initializer
field_identifier "last_edit_at"
: ":"
identifier "now"
, ","
} "}"
) ")"
; ";"
expression_statement
call_expression
field_expression
call_expression
field_expression
field_expression
identifier "this"
. "."
field_identifier "settled_predictions_tx"
. "."
field_identifier "unbounded_send"
arguments
( "("
identifier "now"
) ")"
. "."
field_identifier "ok"
arguments
( "("
) ")"
; ";"
} "}"
} "}"
function_item (+161 nodes collapsed)
function_item (+369 nodes collapsed)
function_item (+271 nodes collapsed)
function_item (+72 nodes collapsed)
function_item (+263 nodes collapsed)
function_item (+764 nodes collapsed)
function_item (+246 nodes collapsed)
const_item
visibility_modifier
pub "pub"
const "const"
identifier "THROTTLE_TIMEOUT"
: ":"
type_identifier "Duration"
= "="
call_expression
scoped_identifier
identifier "Duration"
:: "::"
identifier "from_millis"
arguments
( "("
integer_literal "300"
) ")"
; ";"
} "}"
function_item (+88 nodes collapsed)
impl_item
impl "impl"
type_identifier "EditPredictionStore"
declaration_list
{ "{"
function_item (+1436 nodes collapsed)
function_item (+130 nodes collapsed)
function_item
fn "fn"
identifier "request_prediction_internal"
parameters (+59 nodes collapsed)
-> "->"
generic_type
type_identifier "Task"
type_arguments
< "<"
generic_type
type_identifier "Result"
type_arguments
< "<"
generic_type
type_identifier "Option"
type_arguments
< "<"
type_identifier "EditPredictionResult"
> ">"
> ">"
> ">"
block
{ "{"
expression_statement
call_expression
field_expression
self "self"
. "."
field_identifier "get_or_init_project"
arguments
( "("
reference_expression
& "&"
identifier "project"
, ","
identifier "cx"
) ")"
; ";"
let_declaration (+33 nodes collapsed)
let_declaration
let "let"
identifier "stored_events"
= "="
call_expression
field_expression
identifier "project_state"
. "."
field_identifier "events"
arguments
( "("
identifier "cx"
) ")"
; ";"
let_declaration
let "let"
identifier "has_events"
= "="
unary_expression
! "!"
call_expression
field_expression
identifier "stored_events"
. "."
field_identifier "is_empty"
arguments
( "("
) ")"
; ";"
let_declaration (+58 nodes collapsed)
let_declaration
let "let"
identifier "debug_tx"
= "="
call_expression
field_expression
field_expression
identifier "project_state"
. "."
field_identifier "debug_tx"
. "."
field_identifier "clone"
arguments
( "("
) ")"
; ";"
let_declaration (+21 nodes collapsed)
let_declaration
let "let"
identifier "cursor_point"
= "="
call_expression
field_expression
identifier "position"
. "."
field_identifier "to_point"
arguments
( "("
reference_expression
& "&"
identifier "snapshot"
) ")"
; ";"
let_declaration
let "let"
identifier "current_offset"
= "="
call_expression
field_expression
identifier "position"
. "."
field_identifier "to_offset"
arguments
( "("
reference_expression
& "&"
identifier "snapshot"
) ")"
; ";"
let_declaration (+38 nodes collapsed)
expression_statement (+154 nodes collapsed)
let_declaration
let "let"
identifier "diagnostic_search_start"
= "="
call_expression
field_expression
field_expression
identifier "cursor_point"
. "."
field_identifier "row"
. "."
field_identifier "saturating_sub"
arguments
( "("
identifier "DIAGNOSTIC_LINES_RANGE"
) ")"
; ";"
let_declaration
let "let"
identifier "diagnostic_search_end"
= "="
binary_expression
field_expression
identifier "cursor_point"
. "."
field_identifier "row"
+ "+"
identifier "DIAGNOSTIC_LINES_RANGE"
; ";"
let_declaration (+29 nodes collapsed)
let_declaration
let "let"
identifier "related_files"
= "="
call_expression
field_expression
self "self"
. "."
field_identifier "context_for_project"
arguments
( "("
reference_expression
& "&"
identifier "project"
, ","
identifier "cx"
) ")"
; ";"
let_declaration (+99 nodes collapsed)
let_declaration (+43 nodes collapsed)
let_declaration
let "let"
identifier "recent_paths"
= "="
call_expression
field_expression
field_expression
identifier "project_state"
. "."
field_identifier "recent_paths"
. "."
field_identifier "clone"
arguments
( "("
) ")"
; ";"
let_declaration
let "let"
identifier "inputs"
= "="
struct_expression
type_identifier "EditPredictionModelInput"
field_initializer_list
{ "{"
field_initializer
field_identifier "project"
: ":"
call_expression
field_expression
identifier "project"
. "."
field_identifier "clone"
arguments
( "("
) ")"
, ","
field_initializer
field_identifier "buffer"
: ":"
identifier "active_buffer"
, ","
shorthand_field_initializer
identifier "snapshot"
, ","
shorthand_field_initializer
identifier "position"
, ","
shorthand_field_initializer
identifier "events"
, ","
shorthand_field_initializer
identifier "related_files"
, ","
shorthand_field_initializer
identifier "recent_paths"
, ","
shorthand_field_initializer
identifier "trigger"
, ","
field_initializer
field_identifier "diagnostic_search_range"
: ":"
identifier "diagnostic_search_range"
, ","
shorthand_field_initializer
identifier "debug_tx"
, ","
shorthand_field_initializer
identifier "user_actions"
, ","
shorthand_field_initializer
identifier "can_collect_data"
, ","
shorthand_field_initializer
identifier "is_open_source"
, ","
} "}"
; ";"
let_declaration
let "let"
identifier "capture_data"
= "="
call_expression
field_expression
parenthesized_expression
( "("
binary_expression
identifier "can_collect_data"
&& "&&"
call_expression
scoped_identifier
identifier "rand"
:: "::"
identifier "random_ratio"
arguments
( "("
integer_literal "1"
, ","
integer_literal "1000"
) ")"
) ")"
. "."
field_identifier "then"
arguments
( "("
closure_expression
closure_parameters
| "|"
| "|"
identifier "stored_events"
) ")"
; ";"
let_declaration
let "let"
identifier "task"
= "="
match_expression
match "match"
field_expression
self "self"
. "."
field_identifier "edit_prediction_model"
match_block
{ "{"
match_arm
match_pattern
scoped_identifier
identifier "EditPredictionModel"
:: "::"
identifier "Zeta"
=> "=>"
block
{ "{"
call_expression
scoped_identifier
identifier "zeta"
:: "::"
identifier "request_prediction_with_zeta"
arguments
( "("
self "self"
, ","
identifier "inputs"
, ","
identifier "capture_data"
, ","
identifier "cx"
) ")"
} "}"
match_arm (+26 nodes collapsed)
match_arm (+22 nodes collapsed)
match_arm (+22 nodes collapsed)
} "}"
; ";"
call_expression (+132 nodes collapsed)
} "}"
function_item (+1043 nodes collapsed)
function_item (+231 nodes collapsed)
function_item (+261 nodes collapsed)
function_item (+375 nodes collapsed)
function_item (+720 nodes collapsed)
function_item (+121 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "cfg"
token_tree
( "("
identifier "feature"
= "="
string_literal
" "\""
string_content "cli-support"
" "\""
) ")"
] "]"
function_item (+99 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "cfg"
token_tree
( "("
identifier "feature"
= "="
string_literal
" "\""
string_content "cli-support"
" "\""
) ")"
] "]"
function_item (+98 nodes collapsed)
function_item (+169 nodes collapsed)
function_item (+38 nodes collapsed)
function_item (+124 nodes collapsed)
function_item (+114 nodes collapsed)
function_item (+39 nodes collapsed)
function_item (+27 nodes collapsed)
function_item (+35 nodes collapsed)
function_item (+349 nodes collapsed)
} "}"
function_item (+539 nodes collapsed)
function_item (+159 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Error"
, ","
identifier "Debug"
) ")"
] "]"
attribute_item
# "#"
[ "["
attribute
identifier "error"
token_tree
( "("
string_literal
" "\""
string_content "You must update to Zed version {minimum_version} or higher t"...
" "\""
) ")"
] "]"
struct_item
visibility_modifier
pub "pub"
struct "struct"
type_identifier "ZedUpdateRequiredError"
field_declaration_list
{ "{"
field_declaration
field_identifier "minimum_version"
: ":"
type_identifier "Version"
, ","
} "}"
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
, ","
identifier "Clone"
, ","
identifier "Copy"
) ")"
] "]"
enum_item
visibility_modifier
pub "pub"
enum "enum"
type_identifier "DataCollectionChoice"
enum_variant_list
{ "{"
enum_variant
identifier "NotAnswered"
, ","
enum_variant
identifier "Enabled"
, ","
enum_variant
identifier "Disabled"
, ","
} "}"
impl_item (+146 nodes collapsed)
impl_item (+55 nodes collapsed)
struct_item
struct "struct"
type_identifier "ZedPredictUpsell"
; ";"
impl_item (+130 nodes collapsed)
function_item (+23 nodes collapsed)
function_item (+544 nodes collapsed)