Detailed changes
@@ -308,9 +308,6 @@ impl DisplayMap {
pub struct Highlights<'a> {
pub text_highlights: Option<&'a TextHighlights>,
pub inlay_highlights: Option<&'a InlayHighlights>,
- // TODO kb remove, backgrounds are not handled in the *Map codegi
- pub inlay_background_highlights:
- Option<TreeMap<Option<TypeId>, Arc<(HighlightStyle, &'a [InlayHighlight])>>>,
pub inlay_highlight_style: Option<HighlightStyle>,
pub suggestion_highlight_style: Option<HighlightStyle>,
}
@@ -482,9 +479,6 @@ impl DisplaySnapshot {
&'a self,
display_rows: Range<u32>,
language_aware: bool,
- inlay_background_highlights: Option<
- TreeMap<Option<TypeId>, Arc<(HighlightStyle, &'a [InlayHighlight])>>,
- >,
inlay_highlight_style: Option<HighlightStyle>,
suggestion_highlight_style: Option<HighlightStyle>,
) -> DisplayChunks<'_> {
@@ -494,7 +488,6 @@ impl DisplaySnapshot {
Highlights {
text_highlights: Some(&self.text_highlights),
inlay_highlights: Some(&self.inlay_highlights),
- inlay_background_highlights,
inlay_highlight_style,
suggestion_highlight_style,
},
@@ -1714,7 +1707,7 @@ pub mod tests {
) -> Vec<(String, Option<Color>, Option<Color>)> {
let snapshot = map.update(cx, |map, cx| map.snapshot(cx));
let mut chunks: Vec<(String, Option<Color>, Option<Color>)> = Vec::new();
- for chunk in snapshot.chunks(rows, true, None, None, None) {
+ for chunk in snapshot.chunks(rows, true, None, None) {
let syntax_color = chunk
.syntax_highlight_id
.and_then(|id| id.style(theme)?.color);
@@ -7823,6 +7823,7 @@ impl Editor {
color_fetcher: fn(&Theme) -> Color,
cx: &mut ViewContext<Self>,
) {
+ // TODO: no actual highlights happen for inlays currently, find a way to do that
self.inlay_background_highlights
.insert(Some(TypeId::of::<T>()), (color_fetcher, ranges));
cx.notify();
@@ -54,7 +54,6 @@ use std::{
ops::Range,
sync::Arc,
};
-use sum_tree::TreeMap;
use text::Point;
use workspace::item::Item;
@@ -1548,7 +1547,6 @@ impl EditorElement {
&mut self,
rows: Range<u32>,
line_number_layouts: &[Option<Line>],
- editor: &mut Editor,
snapshot: &EditorSnapshot,
cx: &ViewContext<Editor>,
) -> Vec<LineWithInvisibles> {
@@ -1593,28 +1591,10 @@ impl EditorElement {
.collect()
} else {
let style = &self.style;
- let theme = theme::current(cx);
- let inlay_background_highlights =
- TreeMap::from_ordered_entries(editor.inlay_background_highlights.iter().map(
- |(type_id, (color_fetcher, ranges))| {
- let color = Some(color_fetcher(&theme));
- (
- *type_id,
- Arc::new((
- HighlightStyle {
- color,
- ..HighlightStyle::default()
- },
- ranges.as_slice(),
- )),
- )
- },
- ));
let chunks = snapshot
.chunks(
rows.clone(),
true,
- Some(inlay_background_highlights),
Some(style.theme.hint),
Some(style.theme.suggestion),
)
@@ -2375,13 +2355,8 @@ impl Element<Editor> for EditorElement {
let scrollbar_row_range = scroll_position.y()..(scroll_position.y() + height_in_lines);
let mut max_visible_line_width = 0.0;
- let line_layouts = self.layout_lines(
- start_row..end_row,
- &line_number_layouts,
- editor,
- &snapshot,
- cx,
- );
+ let line_layouts =
+ self.layout_lines(start_row..end_row, &line_number_layouts, &snapshot, cx);
for line_with_invisibles in &line_layouts {
if line_with_invisibles.line.width() > max_visible_line_width {
max_visible_line_width = line_with_invisibles.line.width();
@@ -485,6 +485,7 @@ impl InlayHintCache {
self.hints.clear();
}
+ // TODO kb have a map
pub fn hint_by_id(&self, excerpt_id: ExcerptId, hint_id: InlayId) -> Option<InlayHint> {
self.hints
.get(&excerpt_id)?
@@ -224,7 +224,6 @@ pub fn update_inlay_link_and_hover_points(
extra_shift_left += 1;
extra_shift_right += 1;
}
- // TODO kb is it right for label part cases? for `\n` in hints and fold cases?
if cached_hint.padding_right {
extra_shift_right += 1;
}