Prepare editor to display multiple LSP hover responses for the same place (#9868)

This commit is contained in:
Kirill Bulatov 2024-03-27 20:49:26 +01:00 committed by GitHub
parent ce37885f49
commit 80242584e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 163 additions and 106 deletions

View file

@ -5189,20 +5189,22 @@ impl Project {
buffer: &Model<Buffer>,
position: PointUtf16,
cx: &mut ModelContext<Self>,
) -> Task<Result<Option<Hover>>> {
self.request_lsp(
) -> Task<Result<Vec<Hover>>> {
let request_task = self.request_lsp(
buffer.clone(),
LanguageServerToQuery::Primary,
GetHover { position },
cx,
)
);
cx.spawn(|_, _| async move { request_task.await.map(|hover| hover.into_iter().collect()) })
}
pub fn hover<T: ToPointUtf16>(
&self,
buffer: &Model<Buffer>,
position: T,
cx: &mut ModelContext<Self>,
) -> Task<Result<Option<Hover>>> {
) -> Task<Result<Vec<Hover>>> {
let position = position.to_point_utf16(buffer.read(cx));
self.hover_impl(buffer, position, cx)
}