Remove some todos

This commit is contained in:
Antonio Scandurra 2023-11-03 10:50:30 +01:00
parent 11feda01e3
commit 0dfa3c60b7
2 changed files with 35 additions and 37 deletions

View file

@ -5,30 +5,29 @@ use crate::{Editor, RangeToAnchorExt};
enum MatchingBracketHighlight {}
pub fn refresh_matching_bracket_highlights(editor: &mut Editor, cx: &mut ViewContext<Editor>) {
todo!()
// // editor.clear_background_highlights::<MatchingBracketHighlight>(cx);
// editor.clear_background_highlights::<MatchingBracketHighlight>(cx);
// let newest_selection = editor.selections.newest::<usize>(cx);
// // Don't highlight brackets if the selection isn't empty
// if !newest_selection.is_empty() {
// return;
// }
let newest_selection = editor.selections.newest::<usize>(cx);
// Don't highlight brackets if the selection isn't empty
if !newest_selection.is_empty() {
return;
}
// let head = newest_selection.head();
// let snapshot = editor.snapshot(cx);
// if let Some((opening_range, closing_range)) = snapshot
// .buffer_snapshot
// .innermost_enclosing_bracket_ranges(head..head)
// {
// editor.highlight_background::<MatchingBracketHighlight>(
// vec![
// opening_range.to_anchors(&snapshot.buffer_snapshot),
// closing_range.to_anchors(&snapshot.buffer_snapshot),
// ],
// |theme| theme.editor.document_highlight_read_background,
// cx,
// )
// }
let head = newest_selection.head();
let snapshot = editor.snapshot(cx);
if let Some((opening_range, closing_range)) = snapshot
.buffer_snapshot
.innermost_enclosing_bracket_ranges(head..head)
{
editor.highlight_background::<MatchingBracketHighlight>(
vec![
opening_range.to_anchors(&snapshot.buffer_snapshot),
closing_range.to_anchors(&snapshot.buffer_snapshot),
],
|theme| todo!("theme.editor.document_highlight_read_background"),
cx,
)
}
}
// #[cfg(test)]