Use selection instead of just the cursor when fetching code actions
This commit is contained in:
parent
1eea2f3653
commit
fadb94afb2
6 changed files with 88 additions and 63 deletions
|
@ -1,5 +1,5 @@
|
|||
use super::{Point, ToOffset};
|
||||
use crate::{rope::TextDimension, BufferSnapshot};
|
||||
use crate::{rope::TextDimension, BufferSnapshot, PointUtf16, ToPointUtf16};
|
||||
use anyhow::Result;
|
||||
use std::{cmp::Ordering, fmt::Debug, ops::Range};
|
||||
use sum_tree::Bias;
|
||||
|
@ -78,6 +78,7 @@ pub trait AnchorRangeExt {
|
|||
fn cmp(&self, b: &Range<Anchor>, buffer: &BufferSnapshot) -> Result<Ordering>;
|
||||
fn to_offset(&self, content: &BufferSnapshot) -> Range<usize>;
|
||||
fn to_point(&self, content: &BufferSnapshot) -> Range<Point>;
|
||||
fn to_point_utf16(&self, content: &BufferSnapshot) -> Range<PointUtf16>;
|
||||
}
|
||||
|
||||
impl AnchorRangeExt for Range<Anchor> {
|
||||
|
@ -95,4 +96,8 @@ impl AnchorRangeExt for Range<Anchor> {
|
|||
fn to_point(&self, content: &BufferSnapshot) -> Range<Point> {
|
||||
self.start.summary::<Point>(&content)..self.end.summary::<Point>(&content)
|
||||
}
|
||||
|
||||
fn to_point_utf16(&self, content: &BufferSnapshot) -> Range<PointUtf16> {
|
||||
self.start.to_point_utf16(content)..self.end.to_point_utf16(content)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue