Simplify and restore client resolve capabilities

This commit is contained in:
Kirill Bulatov 2023-08-23 20:22:38 +03:00
parent dcf570bb03
commit 7cd60d6afb
3 changed files with 18 additions and 13 deletions

View File

@ -392,10 +392,6 @@ impl InlayPoint {
pub fn row(self) -> u32 {
self.0.row
}
pub fn column(self) -> u32 {
self.0.column
}
}
impl InlayMap {

View File

@ -7656,13 +7656,16 @@ impl Editor {
}) {
Ok(i) | Err(i) => i,
};
let mut push_region = |start: Option<DisplayPoint>, end: Option<DisplayPoint>| {
let mut push_region = |start: Option<Point>, end: Option<Point>| {
if let (Some(start_display), Some(end_display)) = (start, end) {
results.push(start_display..=end_display);
results.push(
start_display.to_display_point(display_snapshot)
..=end_display.to_display_point(display_snapshot),
);
}
};
let mut start_row: Option<DisplayPoint> = None;
let mut end_row: Option<DisplayPoint> = None;
let mut start_row: Option<Point> = None;
let mut end_row: Option<Point> = None;
if ranges.len() > count {
return Vec::new();
}
@ -7671,13 +7674,17 @@ impl Editor {
if range.start.cmp(&search_range.end).is_ge() {
break;
}
let end = display_snapshot.inlay_offset_to_display_point(range.end, Bias::Right);
let end = display_snapshot
.inlay_offset_to_display_point(range.end, Bias::Right)
.to_point(display_snapshot);
if let Some(current_row) = &end_row {
if end.row() == current_row.row() {
if end.row == current_row.row {
continue;
}
}
let start = display_snapshot.inlay_offset_to_display_point(range.start, Bias::Left);
let start = display_snapshot
.inlay_offset_to_display_point(range.start, Bias::Left)
.to_point(display_snapshot);
if start_row.is_none() {
assert_eq!(end_row, None);
@ -7686,7 +7693,7 @@ impl Editor {
continue;
}
if let Some(current_end) = end_row.as_mut() {
if start.row() > current_end.row() + 1 {
if start.row > current_end.row + 1 {
push_region(start_row, end_row);
start_row = Some(start);
end_row = Some(end);

View File

@ -434,7 +434,9 @@ impl LanguageServer {
..Default::default()
}),
inlay_hint: Some(InlayHintClientCapabilities {
resolve_support: None,
resolve_support: Some(InlayHintResolveClientCapabilities {
properties: vec!["textEdits".to_string(), "tooltip".to_string()],
}),
dynamic_registration: Some(false),
}),
..Default::default()