Skip over folded regions when iterating over multibuffer chunks (#15646)
This commit weaves through new APIs for language::BufferChunks, multi_buffer::MultiBufferChunks and inlay_map::InlayChunks that allow seeking with an upper-bound. This allows us to omit doing syntax highligting and looking up diagnostics for folded ranges. This in turn directly improves performance of assistant panel with large contexts. Release Notes: - Fixed poor performance when editing in the assistant panel after inserting large files using slash commands --------- Co-authored-by: Max <max@zed.dev> Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
co-authored by
Max
Max Brunsfeld
parent
390815dd76
commit
ad11d83724
@@ -225,14 +225,16 @@ pub struct InlayChunks<'a> {
|
||||
}
|
||||
|
||||
impl<'a> InlayChunks<'a> {
|
||||
pub fn seek(&mut self, offset: InlayOffset) {
|
||||
self.transforms.seek(&offset, Bias::Right, &());
|
||||
pub fn seek(&mut self, new_range: Range<InlayOffset>) {
|
||||
self.transforms.seek(&new_range.start, Bias::Right, &());
|
||||
|
||||
let buffer_offset = self.snapshot.to_buffer_offset(offset);
|
||||
self.buffer_chunks.seek(buffer_offset);
|
||||
let buffer_range = self.snapshot.to_buffer_offset(new_range.start)
|
||||
..self.snapshot.to_buffer_offset(new_range.end);
|
||||
self.buffer_chunks.seek(buffer_range);
|
||||
self.inlay_chunks = None;
|
||||
self.buffer_chunk = None;
|
||||
self.output_offset = offset;
|
||||
self.output_offset = new_range.start;
|
||||
self.max_output_offset = new_range.end;
|
||||
}
|
||||
|
||||
pub fn offset(&self) -> InlayOffset {
|
||||
|
||||
Reference in New Issue
Block a user