Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Renames: `HighlightedText`->`HighlightedMatch` + `HighlightedEdits`->`HighlightedText` (#24057)
Michael Sloan93c7b54caa0e
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex 0f387e4c704..3520d7b7bb9 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -96,7 +96,7 @@ use itertools::Itertools;use language::{language_settings::{self, all_language_settings, language_settings, InlayHintSettings},markdown, point_from_lsp, AutoindentMode, BracketPair, Buffer, Capability, CharKind, CodeLabel,- CursorShape, Diagnostic, Documentation, EditPreview, HighlightedEdits, IndentKind, IndentSize,+ CursorShape, Diagnostic, Documentation, EditPreview, HighlightedText, IndentKind, IndentSize,Language, OffsetRangeExt, Point, Selection, SelectionGoal, TextObject, TransactionId,TreeSitterOptions,};@@ -488,7 +488,7 @@ impl InlineCompletionMenuHint {#[derive(Clone, Debug)]enum InlineCompletionText {Move(SharedString),- Edit(HighlightedEdits),+ Edit(HighlightedText),}pub(crate) enum EditDisplayMode {@@ -15850,7 +15850,7 @@ fn inline_completion_edit_text(edit_preview: &EditPreview,include_deletions: bool,cx: &App,-) -> Option<HighlightedEdits> {+) -> Option<HighlightedText> {let edits = edits.iter().map(|(anchor, text)| {diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rsindex bbf631c671c..a3f94eadfdf 100644--- a/crates/editor/src/editor_tests.rs+++ b/crates/editor/src/editor_tests.rs@@ -15417,7 +15417,7 @@ async fn assert_highlighted_edits(edits: Vec<(Range<Point>, String)>,include_deletions: bool,cx: &mut TestAppContext,- assertion_fn: impl Fn(HighlightedEdits, &App),+ assertion_fn: impl Fn(HighlightedText, &App),) {let window = cx.add_window(|window, cx| {let buffer = MultiBuffer::build_simple(text, cx);diff --git a/crates/language/src/buffer.rs b/crates/language/src/buffer.rsindex eba9b06b383..99424502ee2 100644--- a/crates/language/src/buffer.rs+++ b/crates/language/src/buffer.rs@@ -596,7 +596,7 @@ pub struct EditPreview {}#[derive(Default, Clone, Debug)]-pub struct HighlightedEdits {+pub struct HighlightedText {pub text: SharedString,pub highlights: Vec<(Range<usize>, HighlightStyle)>,}@@ -608,9 +608,9 @@ impl EditPreview {edits: &[(Range<Anchor>, String)],include_deletions: bool,cx: &App,- ) -> HighlightedEdits {+ ) -> HighlightedText {let Some(visible_range_in_preview_snapshot) = self.compute_visible_range(edits) else {- return HighlightedEdits::default();+ return HighlightedText::default();};let mut text = String::new();@@ -686,7 +686,7 @@ impl EditPreview {cx,);- HighlightedEdits {+ HighlightedText {text: text.into(),highlights,}diff --git a/crates/language/src/buffer_tests.rs b/crates/language/src/buffer_tests.rsindex 2beae53e2f6..4a2f94b8357 100644--- a/crates/language/src/buffer_tests.rs+++ b/crates/language/src/buffer_tests.rs@@ -2739,7 +2739,7 @@ async fn test_preview_edits(cx: &mut TestAppContext) {edits: Vec<(Range<Point>, &str)>,include_deletions: bool,cx: &mut TestAppContext,- assert_fn: impl Fn(HighlightedEdits),+ assert_fn: impl Fn(HighlightedText),) {let buffer = cx.new(|cx| Buffer::local(text, cx).with_language(Arc::new(rust_lang()), cx));let edits = buffer.read_with(cx, |buffer, _| {diff --git a/crates/picker/src/highlighted_match_with_paths.rs b/crates/picker/src/highlighted_match_with_paths.rsindex 0135e9c4407..9455ec3d434 100644--- a/crates/picker/src/highlighted_match_with_paths.rs+++ b/crates/picker/src/highlighted_match_with_paths.rs@@ -2,19 +2,19 @@ use ui::{prelude::*, HighlightedLabel};#[derive(Clone)]pub struct HighlightedMatchWithPaths {- pub match_label: HighlightedText,- pub paths: Vec<HighlightedText>,+ pub match_label: HighlightedMatch,+ pub paths: Vec<HighlightedMatch>,}#[derive(Debug, Clone, IntoElement)]-pub struct HighlightedText {+pub struct HighlightedMatch {pub text: String,pub highlight_positions: Vec<usize>,pub char_count: usize,pub color: Color,}-impl HighlightedText {+impl HighlightedMatch {pub fn join(components: impl Iterator<Item = Self>, separator: &str) -> Self {let mut char_count = 0;let separator_char_count = separator.chars().count();@@ -48,7 +48,7 @@ impl HighlightedText {Self { color, ..self }}}-impl RenderOnce for HighlightedText {+impl RenderOnce for HighlightedMatch {fn render(self, _window: &mut Window, _: &mut App) -> impl IntoElement {HighlightedLabel::new(self.text, self.highlight_positions).color(self.color)}diff --git a/crates/recent_projects/src/recent_projects.rs b/crates/recent_projects/src/recent_projects.rsindex 28b57566196..1d21d5860e0 100644--- a/crates/recent_projects/src/recent_projects.rs+++ b/crates/recent_projects/src/recent_projects.rs@@ -11,7 +11,7 @@ use gpui::{};use ordered_float::OrderedFloat;use picker::{- highlighted_match_with_paths::{HighlightedMatchWithPaths, HighlightedText},+ highlighted_match_with_paths::{HighlightedMatch, HighlightedMatchWithPaths},Picker, PickerDelegate,};pub use remote_servers::RemoteServerProjects;@@ -386,7 +386,7 @@ impl PickerDelegate for RecentProjectsDelegate {.unzip();let highlighted_match = HighlightedMatchWithPaths {- match_label: HighlightedText::join(match_labels.into_iter().flatten(), ", "),+ match_label: HighlightedMatch::join(match_labels.into_iter().flatten(), ", "),paths,};@@ -487,7 +487,7 @@ fn highlights_for_path(path: &Path,match_positions: &Vec<usize>,path_start_offset: usize,-) -> (Option<HighlightedText>, HighlightedText) {+) -> (Option<HighlightedMatch>, HighlightedMatch) {let path_string = path.to_string_lossy();let path_char_count = path_string.chars().count();// Get the subset of match highlight positions that line up with the given path.@@ -513,7 +513,7 @@ fn highlights_for_path(.take_while(|position| *position < file_name_start + char_count).map(|position| position - file_name_start).collect::<Vec<_>>();- HighlightedText {+ HighlightedMatch {text: text.to_string(),highlight_positions,char_count,@@ -523,7 +523,7 @@ fn highlights_for_path((file_name_text_and_positions,- HighlightedText {+ HighlightedMatch {text: path_string.to_string(),highlight_positions: path_positions,char_count: path_char_count,diff --git a/crates/tasks_ui/src/modal.rs b/crates/tasks_ui/src/modal.rsindex f92673b2a9d..4d65f772f2c 100644--- a/crates/tasks_ui/src/modal.rs+++ b/crates/tasks_ui/src/modal.rs@@ -7,7 +7,7 @@ use gpui::{Focusable, InteractiveElement, ParentElement, Render, SharedString, Styled, Subscription, Task,WeakEntity, Window,};-use picker::{highlighted_match_with_paths::HighlightedText, Picker, PickerDelegate};+use picker::{highlighted_match_with_paths::HighlightedMatch, Picker, PickerDelegate};use project::{task_store::TaskStore, TaskSourceKind};use task::{ResolvedTask, RevealTarget, TaskContext, TaskTemplate};use ui::{@@ -356,7 +356,7 @@ impl PickerDelegate for TasksModalDelegate {Some(Tooltip::simple(tooltip_label_text, cx))};- let highlighted_location = HighlightedText {+ let highlighted_location = HighlightedMatch {text: hit.string.clone(),highlight_positions: hit.positions.clone(),char_count: hit.string.chars().count(),