Extract an ExcerptRange containing a context field in multi_buffer

This lays the groundwork for adding an optional `primary` field that can
be supplied to provide the "jump to" feature.
This commit is contained in:
Antonio Scandurra 2022-06-08 12:13:04 +02:00
parent d56cc1a5c1
commit ffb75b0f02
6 changed files with 231 additions and 100 deletions

View file

@ -272,7 +272,7 @@ pub fn surrounding_word(map: &DisplaySnapshot, position: DisplayPoint) -> Range<
#[cfg(test)]
mod tests {
use super::*;
use crate::{test::marked_display_snapshot, Buffer, DisplayMap, MultiBuffer};
use crate::{test::marked_display_snapshot, Buffer, DisplayMap, ExcerptRange, MultiBuffer};
use language::Point;
use settings::Settings;
@ -494,8 +494,12 @@ mod tests {
multibuffer.push_excerpts(
buffer.clone(),
[
Point::new(0, 0)..Point::new(1, 4),
Point::new(2, 0)..Point::new(3, 2),
ExcerptRange {
context: Point::new(0, 0)..Point::new(1, 4),
},
ExcerptRange {
context: Point::new(2, 0)..Point::new(3, 2),
},
],
cx,
);