mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-30 21:16:23 +00:00
Replace todo!s with stub calls to make Zed work
This commit is contained in:
parent
4c3c0eb796
commit
83f4320b60
1 changed files with 64 additions and 23 deletions
|
@ -6,7 +6,10 @@ use std::ops::{Add, AddAssign, Range, Sub};
|
|||
use crate::MultiBufferSnapshot;
|
||||
|
||||
use super::{
|
||||
suggestion_map::{SuggestionEdit, SuggestionPoint, SuggestionSnapshot},
|
||||
suggestion_map::{
|
||||
SuggestionBufferRows, SuggestionChunks, SuggestionEdit, SuggestionOffset, SuggestionPoint,
|
||||
SuggestionSnapshot,
|
||||
},
|
||||
TextHighlights,
|
||||
};
|
||||
use gpui::fonts::HighlightStyle;
|
||||
|
@ -58,12 +61,11 @@ pub struct EditorAdditionPoint(pub Point);
|
|||
|
||||
#[derive(Clone)]
|
||||
pub struct EditorAdditionBufferRows<'a> {
|
||||
_z: &'a std::marker::PhantomData<()>,
|
||||
suggestion_rows: SuggestionBufferRows<'a>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct EditorAdditionChunks<'a> {
|
||||
_z: &'a std::marker::PhantomData<()>,
|
||||
suggestion_chunks: SuggestionChunks<'a>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -76,7 +78,7 @@ impl<'a> Iterator for EditorAdditionChunks<'a> {
|
|||
type Item = Chunk<'a>;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
todo!("TODO kb")
|
||||
self.suggestion_chunks.next()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,7 +86,7 @@ impl<'a> Iterator for EditorAdditionBufferRows<'a> {
|
|||
type Item = Option<u32>;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
todo!("TODO kb")
|
||||
self.suggestion_rows.next()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,9 +125,15 @@ impl EditorAdditionMap {
|
|||
snapshot.version += 1;
|
||||
}
|
||||
|
||||
let editor_addition_edits = Vec::new();
|
||||
{
|
||||
todo!("TODO kb")
|
||||
let mut editor_addition_edits = Vec::new();
|
||||
for suggestion_edit in suggestion_edits {
|
||||
let old = suggestion_edit.old;
|
||||
let new = suggestion_edit.new;
|
||||
// TODO kb copied from suggestion_map
|
||||
editor_addition_edits.push(EditorAdditionEdit {
|
||||
old: EditorAdditionOffset(old.start.0)..EditorAdditionOffset(old.end.0),
|
||||
new: EditorAdditionOffset(old.start.0)..EditorAdditionOffset(new.end.0),
|
||||
})
|
||||
}
|
||||
|
||||
snapshot.suggestion_snapshot = suggestion_snapshot;
|
||||
|
@ -140,47 +148,71 @@ impl EditorAdditionMap {
|
|||
|
||||
impl EditorAdditionSnapshot {
|
||||
pub fn buffer_snapshot(&self) -> &MultiBufferSnapshot {
|
||||
todo!("TODO kb")
|
||||
// TODO kb copied from suggestion_map
|
||||
self.suggestion_snapshot.buffer_snapshot()
|
||||
}
|
||||
|
||||
pub fn to_point(&self, offset: EditorAdditionOffset) -> EditorAdditionPoint {
|
||||
todo!("TODO kb")
|
||||
// TODO kb copied from suggestion_map
|
||||
self.to_editor_addition_point(
|
||||
self.suggestion_snapshot
|
||||
.to_point(super::suggestion_map::SuggestionOffset(offset.0)),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn max_point(&self) -> EditorAdditionPoint {
|
||||
todo!("TODO kb")
|
||||
// TODO kb copied from suggestion_map
|
||||
self.to_editor_addition_point(self.suggestion_snapshot.max_point())
|
||||
}
|
||||
|
||||
pub fn to_offset(&self, point: EditorAdditionPoint) -> EditorAdditionOffset {
|
||||
todo!("TODO kb")
|
||||
// TODO kb copied from suggestion_map
|
||||
EditorAdditionOffset(
|
||||
self.suggestion_snapshot
|
||||
.to_offset(self.to_suggestion_point(point, Bias::Left))
|
||||
.0,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn chars_at(&self, start: EditorAdditionPoint) -> impl '_ + Iterator<Item = char> {
|
||||
Vec::new().into_iter()
|
||||
self.suggestion_snapshot
|
||||
.chars_at(self.to_suggestion_point(start, Bias::Left))
|
||||
}
|
||||
|
||||
pub fn to_suggestion_point(&self, point: EditorAdditionPoint, bias: Bias) -> SuggestionPoint {
|
||||
todo!("TODO kb")
|
||||
// TODO kb what to do with bias?
|
||||
pub fn to_suggestion_point(&self, point: EditorAdditionPoint, _: Bias) -> SuggestionPoint {
|
||||
SuggestionPoint(point.0)
|
||||
}
|
||||
|
||||
pub fn to_editor_addition_point(&self, point: SuggestionPoint) -> EditorAdditionPoint {
|
||||
todo!("TODO kb")
|
||||
EditorAdditionPoint(point.0)
|
||||
}
|
||||
|
||||
pub fn clip_point(&self, point: EditorAdditionPoint, bias: Bias) -> EditorAdditionPoint {
|
||||
todo!("TODO kb")
|
||||
// TODO kb copied from suggestion_map
|
||||
self.to_editor_addition_point(
|
||||
self.suggestion_snapshot
|
||||
.clip_point(self.to_suggestion_point(point, bias), bias),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn text_summary_for_range(&self, range: Range<EditorAdditionPoint>) -> TextSummary {
|
||||
todo!("TODO kb")
|
||||
// TODO kb copied from suggestion_map
|
||||
self.suggestion_snapshot.text_summary_for_range(
|
||||
self.to_suggestion_point(range.start, Bias::Left)
|
||||
..self.to_suggestion_point(range.end, Bias::Left),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn buffer_rows<'a>(&'a self, row: u32) -> EditorAdditionBufferRows<'a> {
|
||||
todo!("TODO kb")
|
||||
EditorAdditionBufferRows {
|
||||
suggestion_rows: self.suggestion_snapshot.buffer_rows(row),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn line_len(&self, row: u32) -> u32 {
|
||||
todo!("TODO kb")
|
||||
// TODO kb copied from suggestion_map
|
||||
self.suggestion_snapshot.line_len(row)
|
||||
}
|
||||
|
||||
pub fn chunks<'a>(
|
||||
|
@ -190,11 +222,20 @@ impl EditorAdditionSnapshot {
|
|||
text_highlights: Option<&'a TextHighlights>,
|
||||
suggestion_highlight: Option<HighlightStyle>,
|
||||
) -> EditorAdditionChunks<'a> {
|
||||
todo!("TODO kb")
|
||||
// TODO kb copied from suggestion_map
|
||||
EditorAdditionChunks {
|
||||
suggestion_chunks: self.suggestion_snapshot.chunks(
|
||||
SuggestionOffset(range.start.0)..SuggestionOffset(range.end.0),
|
||||
language_aware,
|
||||
text_highlights,
|
||||
suggestion_highlight,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub fn text(&self) -> String {
|
||||
todo!("TODO kb")
|
||||
// TODO kb copied from suggestion_map
|
||||
self.suggestion_snapshot.text()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue