Fix prefix/suffix calculation when determining copilot suggestion

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
Antonio Scandurra
2023-03-31 18:05:07 +02:00
co-authored by Nathan Sobo Mikayla Maki
parent b588ba1435
commit 5f579a4287
3 changed files with 30 additions and 20 deletions
+4
View File
@@ -2933,6 +2933,10 @@ impl MultiBufferSnapshot {
Some(self.excerpt(excerpt_id)?.buffer_id)
}
pub fn buffer_for_excerpt(&self, excerpt_id: ExcerptId) -> Option<&BufferSnapshot> {
Some(&self.excerpt(excerpt_id)?.buffer)
}
fn excerpt<'a>(&'a self, excerpt_id: ExcerptId) -> Option<&'a Excerpt> {
let mut cursor = self.excerpts.cursor::<Option<&Locator>>();
let locator = self.excerpt_locator_for_id(excerpt_id);