Get minimal POC working

This commit is contained in:
Isaac Clayton 2022-05-30 17:00:45 +02:00 committed by Keith Simmons
parent 24ad60a651
commit 470c70d394
5 changed files with 200 additions and 37 deletions

View file

@ -302,6 +302,7 @@ impl Project {
client.add_model_request_handler(Self::handle_format_buffers);
client.add_model_request_handler(Self::handle_get_code_actions);
client.add_model_request_handler(Self::handle_get_completions);
client.add_model_request_handler(Self::handle_lsp_command::<GetHover>);
client.add_model_request_handler(Self::handle_lsp_command::<GetDefinition>);
client.add_model_request_handler(Self::handle_lsp_command::<GetDocumentHighlights>);
client.add_model_request_handler(Self::handle_lsp_command::<GetReferences>);
@ -2884,6 +2885,17 @@ impl Project {
}
}
pub fn hover<T: ToPointUtf16>(
&self,
buffer: &ModelHandle<Buffer>,
position: T,
cx: &mut ModelContext<Self>,
) -> Task<Result<Option<lsp::Hover>>> {
// TODO: proper return type
let position = position.to_point_utf16(buffer.read(cx));
self.request_lsp(buffer.clone(), GetHover { position }, cx)
}
pub fn completions<T: ToPointUtf16>(
&self,
source_buffer_handle: &ModelHandle<Buffer>,