Properly resolve inlay label parts' locations and buffers

This commit is contained in:
Kirill Bulatov 2023-08-21 20:21:38 +03:00
parent 7eab18ec89
commit 477fc865f5
5 changed files with 222 additions and 132 deletions

View file

@ -5054,22 +5054,23 @@ impl Project {
}
let buffer_snapshot = buffer.snapshot();
cx.spawn(|project, cx| async move {
cx.spawn(|project, mut cx| async move {
let resolve_task = lang_server.request::<lsp::request::InlayHintResolveRequest>(
InlayHints::project_to_lsp_hint(hint, &project, &buffer_snapshot, &cx),
);
let resolved_hint = resolve_task
.await
.context("inlay hint resolve LSP request")?;
let resolved_hint = cx.read(|cx| {
InlayHints::lsp_to_project_hint(
resolved_hint,
&buffer_handle,
ResolveState::Resolved,
false,
cx,
)
});
let resolved_hint = InlayHints::lsp_to_project_hint(
resolved_hint,
&project,
&buffer_handle,
server_id,
ResolveState::Resolved,
false,
&mut cx,
)
.await?;
Ok(Some(resolved_hint))
})
} else if let Some(project_id) = self.remote_id() {