Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Revert useless changes, simplify
Kirill Bulatov096bad1f7393
diff --git a/crates/collab/src/tests/integration_tests.rs b/crates/collab/src/tests/integration_tests.rsindex 5ff7f09ff88..8095b39a7f8 100644--- a/crates/collab/src/tests/integration_tests.rs+++ b/crates/collab/src/tests/integration_tests.rs@@ -6406,7 +6406,6 @@ async fn test_basic_following(let client_b = server.create_client(cx_b, "user_b").await;let client_c = server.create_client(cx_c, "user_c").await;let client_d = server.create_client(cx_d, "user_d").await;-server.create_room(&mut [(&client_a, cx_a),@@ -7944,8 +7943,7 @@ async fn test_mutual_editor_inlay_hint_cache_update(cx_a.foreground().finish_waiting();cx_a.foreground().run_until_parked();- let mut edits_made = 0;- edits_made += 1;+ let mut edits_made = 1;editor_a.update(cx_a, |editor, _| {assert_eq!(vec!["0".to_string()],diff --git a/crates/editor/Cargo.toml b/crates/editor/Cargo.tomlindex 61145e40ff1..dcc22202273 100644--- a/crates/editor/Cargo.toml+++ b/crates/editor/Cargo.toml@@ -10,6 +10,7 @@ doctest = false[features]test-support = [+ "rand","copilot/test-support","text/test-support","language/test-support",@@ -56,7 +57,7 @@ ordered-float.workspace = trueparking_lot.workspace = truepostage.workspace = truepulldown-cmark = { version = "0.9.2", default-features = false }-rand = { workspace = true }+rand = { workspace = true, optional = true }schemars.workspace = trueserde.workspace = trueserde_derive.workspace = truediff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex 5d5bdd1db40..65beec6d973 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -1,5 +1,4 @@mod blink_manager;-pub mod display_map;mod editor_settings;mod element;@@ -54,7 +53,7 @@ use gpui::{};use highlight_matching_bracket::refresh_matching_bracket_highlights;use hover_popover::{hide_hover, HoverState};-use inlay_hint_cache::{visible_inlay_hints, InlayHintCache, InlaySplice, InvalidationStrategy};+use inlay_hint_cache::{InlayHintCache, InlaySplice, InvalidationStrategy};pub use items::MAX_TAB_TITLE_LEN;use itertools::Itertools;pub use language::{char_kind, CharKind};@@ -2617,7 +2616,7 @@ impl Editor {let new_splice = self.inlay_hint_cache.update_settings(&self.buffer,new_settings,- visible_inlay_hints(self, cx).cloned().collect(),+ self.visible_inlay_hints(cx),cx,);if let Some(InlaySplice {@@ -2648,6 +2647,17 @@ impl Editor {}}+ fn visible_inlay_hints(&self, cx: &ViewContext<'_, '_, Editor>) -> Vec<Inlay> {+ self.display_map+ .read(cx)+ .current_inlays()+ .filter(move |inlay| {+ Some(inlay.id) != self.copilot_state.suggestion.as_ref().map(|h| h.id)+ })+ .cloned()+ .collect()+ }+fn excerpt_visible_offsets(&self,cx: &mut ViewContext<'_, '_, Editor>,@@ -5659,7 +5669,6 @@ impl Editor {}}- // TODO: Handle selections that cross excerpts// TODO: Handle selections that cross excerptsfor selection in &mut selections {let start_column = snapshot.indent_size_for_line(selection.start.row).len;@@ -7257,37 +7266,21 @@ impl Editor {buffer,predecessor,excerpts,- } => {- cx.emit(Event::ExcerptsAdded {- buffer: buffer.clone(),- predecessor: *predecessor,- excerpts: excerpts.clone(),- });- }+ } => cx.emit(Event::ExcerptsAdded {+ buffer: buffer.clone(),+ predecessor: *predecessor,+ excerpts: excerpts.clone(),+ }),multi_buffer::Event::ExcerptsRemoved { ids } => {- cx.emit(Event::ExcerptsRemoved { ids: ids.clone() });- }- multi_buffer::Event::Reparsed => {- cx.emit(Event::Reparsed);- }- multi_buffer::Event::DirtyChanged => {- cx.emit(Event::DirtyChanged);- }- multi_buffer::Event::Saved => {- cx.emit(Event::Saved);- }- multi_buffer::Event::FileHandleChanged => {- cx.emit(Event::TitleChanged);- }- multi_buffer::Event::Reloaded => {- cx.emit(Event::TitleChanged);- }- multi_buffer::Event::DiffBaseChanged => {- cx.emit(Event::DiffBaseChanged);- }- multi_buffer::Event::Closed => {- cx.emit(Event::Closed);- }+ cx.emit(Event::ExcerptsRemoved { ids: ids.clone() })+ }+ multi_buffer::Event::Reparsed => cx.emit(Event::Reparsed),+ multi_buffer::Event::DirtyChanged => cx.emit(Event::DirtyChanged),+ multi_buffer::Event::Saved => cx.emit(Event::Saved),+ multi_buffer::Event::FileHandleChanged => cx.emit(Event::TitleChanged),+ multi_buffer::Event::Reloaded => cx.emit(Event::TitleChanged),+ multi_buffer::Event::DiffBaseChanged => cx.emit(Event::DiffBaseChanged),+ multi_buffer::Event::Closed => cx.emit(Event::Closed),multi_buffer::Event::DiagnosticsUpdated => {self.refresh_active_diagnostics(cx);}diff --git a/crates/editor/src/inlay_hint_cache.rs b/crates/editor/src/inlay_hint_cache.rsindex d0274b516d3..bee08f6cc73 100644--- a/crates/editor/src/inlay_hint_cache.rs+++ b/crates/editor/src/inlay_hint_cache.rs@@ -306,7 +306,7 @@ fn spawn_new_update_tasks(update_cache_version: usize,cx: &mut ViewContext<'_, '_, Editor>,) {- let visible_hints = Arc::new(visible_inlay_hints(editor, cx).cloned().collect::<Vec<_>>());+ let visible_hints = Arc::new(editor.visible_inlay_hints(cx));for (excerpt_id, (buffer_handle, excerpt_visible_range)) in excerpts_to_query {if !excerpt_visible_range.is_empty() {let buffer = buffer_handle.read(cx);@@ -786,17 +786,6 @@ fn hints_fetch_tasks(}}-pub fn visible_inlay_hints<'a, 'b: 'a, 'c, 'd: 'a>(- editor: &'a Editor,- cx: &'b ViewContext<'c, 'd, Editor>,-) -> impl Iterator<Item = &'b Inlay> + 'a {- editor- .display_map- .read(cx)- .current_inlays()- .filter(|inlay| Some(inlay.id) != editor.copilot_state.suggestion.as_ref().map(|h| h.id))-}-fn contains_position(range: &Range<language::Anchor>,position: language::Anchor,diff --git a/crates/editor/src/multi_buffer.rs b/crates/editor/src/multi_buffer.rsindex d4298efacf1..c5070363eb7 100644--- a/crates/editor/src/multi_buffer.rs+++ b/crates/editor/src/multi_buffer.rs@@ -2631,7 +2631,6 @@ impl MultiBufferSnapshot {};}}-panic!("excerpt not found")}