mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-26 20:04:15 +03:00
Remove some todos
This commit is contained in:
parent
11feda01e3
commit
0dfa3c60b7
@ -36,8 +36,9 @@ pub use element::{
|
||||
use futures::FutureExt;
|
||||
use fuzzy::{StringMatch, StringMatchCandidate};
|
||||
use gpui::{
|
||||
AnyElement, AppContext, BackgroundExecutor, Context, Element, EventEmitter, Hsla, Model,
|
||||
Pixels, Render, Subscription, Task, TextStyle, View, ViewContext, WeakView, WindowContext,
|
||||
AnyElement, AppContext, BackgroundExecutor, Context, Element, EventEmitter, FocusHandle, Hsla,
|
||||
Model, Pixels, Render, Subscription, Task, TextStyle, View, ViewContext, WeakView,
|
||||
WindowContext,
|
||||
};
|
||||
use highlight_matching_bracket::refresh_matching_bracket_highlights;
|
||||
use hover_popover::{hide_hover, HoverState};
|
||||
@ -606,6 +607,7 @@ type InlayBackgroundHighlight = (fn(&ThemeColors) -> Hsla, Vec<InlayHighlight>);
|
||||
|
||||
pub struct Editor {
|
||||
handle: WeakView<Self>,
|
||||
focus_handle: FocusHandle,
|
||||
buffer: Model<MultiBuffer>,
|
||||
display_map: Model<DisplayMap>,
|
||||
pub selections: SelectionsCollection,
|
||||
@ -1912,6 +1914,7 @@ impl Editor {
|
||||
|
||||
let mut this = Self {
|
||||
handle: cx.view().downgrade(),
|
||||
focus_handle: cx.focus_handle(),
|
||||
buffer: buffer.clone(),
|
||||
display_map: display_map.clone(),
|
||||
selections,
|
||||
@ -2066,19 +2069,15 @@ impl Editor {
|
||||
// }
|
||||
|
||||
pub fn snapshot(&mut self, cx: &mut WindowContext) -> EditorSnapshot {
|
||||
todo!()
|
||||
// EditorSnapshot {
|
||||
// mode: self.mode,
|
||||
// show_gutter: self.show_gutter,
|
||||
// display_snapshot: self.display_map.update(cx, |map, cx| map.snapshot(cx)),
|
||||
// scroll_anchor: self.scroll_manager.anchor(),
|
||||
// ongoing_scroll: self.scroll_manager.ongoing_scroll(),
|
||||
// placeholder_text: self.placeholder_text.clone(),
|
||||
// is_focused: self
|
||||
// .handle
|
||||
// .upgrade(cx)
|
||||
// .map_or(false, |handle| handle.is_focused(cx)),
|
||||
// }
|
||||
EditorSnapshot {
|
||||
mode: self.mode,
|
||||
show_gutter: self.show_gutter,
|
||||
display_snapshot: self.display_map.update(cx, |map, cx| map.snapshot(cx)),
|
||||
scroll_anchor: self.scroll_manager.anchor(),
|
||||
ongoing_scroll: self.scroll_manager.ongoing_scroll(),
|
||||
placeholder_text: self.placeholder_text.clone(),
|
||||
is_focused: self.focus_handle.is_focused(cx),
|
||||
}
|
||||
}
|
||||
|
||||
// pub fn language_at<'a, T: ToOffset>(
|
||||
|
@ -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)]
|
||||
|
Loading…
Reference in New Issue
Block a user