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

@ -36,8 +36,9 @@ pub use element::{
use futures::FutureExt; use futures::FutureExt;
use fuzzy::{StringMatch, StringMatchCandidate}; use fuzzy::{StringMatch, StringMatchCandidate};
use gpui::{ use gpui::{
AnyElement, AppContext, BackgroundExecutor, Context, Element, EventEmitter, Hsla, Model, AnyElement, AppContext, BackgroundExecutor, Context, Element, EventEmitter, FocusHandle, Hsla,
Pixels, Render, Subscription, Task, TextStyle, View, ViewContext, WeakView, WindowContext, Model, Pixels, Render, Subscription, Task, TextStyle, View, ViewContext, WeakView,
WindowContext,
}; };
use highlight_matching_bracket::refresh_matching_bracket_highlights; use highlight_matching_bracket::refresh_matching_bracket_highlights;
use hover_popover::{hide_hover, HoverState}; use hover_popover::{hide_hover, HoverState};
@ -606,6 +607,7 @@ type InlayBackgroundHighlight = (fn(&ThemeColors) -> Hsla, Vec<InlayHighlight>);
pub struct Editor { pub struct Editor {
handle: WeakView<Self>, handle: WeakView<Self>,
focus_handle: FocusHandle,
buffer: Model<MultiBuffer>, buffer: Model<MultiBuffer>,
display_map: Model<DisplayMap>, display_map: Model<DisplayMap>,
pub selections: SelectionsCollection, pub selections: SelectionsCollection,
@ -1912,6 +1914,7 @@ impl Editor {
let mut this = Self { let mut this = Self {
handle: cx.view().downgrade(), handle: cx.view().downgrade(),
focus_handle: cx.focus_handle(),
buffer: buffer.clone(), buffer: buffer.clone(),
display_map: display_map.clone(), display_map: display_map.clone(),
selections, selections,
@ -2066,19 +2069,15 @@ impl Editor {
// } // }
pub fn snapshot(&mut self, cx: &mut WindowContext) -> EditorSnapshot { pub fn snapshot(&mut self, cx: &mut WindowContext) -> EditorSnapshot {
todo!() EditorSnapshot {
// EditorSnapshot { mode: self.mode,
// mode: self.mode, show_gutter: self.show_gutter,
// show_gutter: self.show_gutter, display_snapshot: self.display_map.update(cx, |map, cx| map.snapshot(cx)),
// display_snapshot: self.display_map.update(cx, |map, cx| map.snapshot(cx)), scroll_anchor: self.scroll_manager.anchor(),
// scroll_anchor: self.scroll_manager.anchor(), ongoing_scroll: self.scroll_manager.ongoing_scroll(),
// ongoing_scroll: self.scroll_manager.ongoing_scroll(), placeholder_text: self.placeholder_text.clone(),
// placeholder_text: self.placeholder_text.clone(), is_focused: self.focus_handle.is_focused(cx),
// is_focused: self }
// .handle
// .upgrade(cx)
// .map_or(false, |handle| handle.is_focused(cx)),
// }
} }
// pub fn language_at<'a, T: ToOffset>( // pub fn language_at<'a, T: ToOffset>(

View file

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