Use proper anchors for remote LSP queries

This commit is contained in:
Kirill Bulatov 2023-06-22 14:55:32 +03:00
parent cb4b92aa61
commit c61de29c11

View file

@ -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 let buffer_hints = this
.update(&mut cx, |project, cx| { .update(&mut cx, |project, cx| {
let buffer_end = buffer.read(cx).len(); project.inlay_hints(buffer, start..end, cx)
// 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,
)
}) })
.await .await
.context("inlay hints fetch")? .context("inlay hints fetch")?