Use LSP range formatting when document formatting is not available

This commit is contained in:
Antonio Scandurra 2022-03-04 10:11:10 +01:00
parent dc5a09b3f7
commit 46da80d726
3 changed files with 43 additions and 9 deletions

View file

@ -126,6 +126,10 @@ impl Rope {
self.chunks.extent(&())
}
pub fn max_point_utf16(&self) -> PointUtf16 {
self.chunks.extent(&())
}
pub fn cursor(&self, offset: usize) -> Cursor {
Cursor::new(self, offset)
}

View file

@ -1526,6 +1526,10 @@ impl BufferSnapshot {
self.visible_text.max_point()
}
pub fn max_point_utf16(&self) -> PointUtf16 {
self.visible_text.max_point_utf16()
}
pub fn point_to_offset(&self, point: Point) -> usize {
self.visible_text.point_to_offset(point)
}