Revert useless changes, simplify
This commit is contained in:
parent
f77b680db9
commit
096bad1f73
5 changed files with 30 additions and 50 deletions
|
@ -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()],
|
||||
|
|
|
@ -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 = true
|
|||
parking_lot.workspace = true
|
||||
postage.workspace = true
|
||||
pulldown-cmark = { version = "0.9.2", default-features = false }
|
||||
rand = { workspace = true }
|
||||
rand = { workspace = true, optional = true }
|
||||
schemars.workspace = true
|
||||
serde.workspace = true
|
||||
serde_derive.workspace = true
|
||||
|
|
|
@ -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 excerpts
|
||||
for 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);
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -2631,7 +2631,6 @@ impl MultiBufferSnapshot {
|
|||
};
|
||||
}
|
||||
}
|
||||
|
||||
panic!("excerpt not found")
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue