From c61de29c113c61851d81e3d1d1c3f42afbe1639f Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Thu, 22 Jun 2023 14:55:32 +0300 Subject: [PATCH] Use proper anchors for remote LSP queries --- crates/project/src/project.rs | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 7b868ba54a..5da143f602 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -6764,22 +6764,19 @@ impl Project { ) })?; + let start = envelope + .payload + .start + .and_then(deserialize_anchor) + .context("missing range start")?; + let end = envelope + .payload + .end + .and_then(deserialize_anchor) + .context("missing range end")?; let buffer_hints = this .update(&mut cx, |project, cx| { - let buffer_end = buffer.read(cx).len(); - // TODO kb use cache before querying? - project.inlay_hints( - buffer, - envelope - .payload - .start - .map_or(0, |anchor| anchor.offset as usize) - ..envelope - .payload - .end - .map_or(buffer_end, |anchor| anchor.offset as usize), - cx, - ) + project.inlay_hints(buffer, start..end, cx) }) .await .context("inlay hints fetch")?