aboutsummaryrefslogtreecommitdiff
path: root/helix-lsp/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-02-25 09:07:47 +0000
committerBlaž Hrastnik2021-02-25 09:07:47 +0000
commit7162632eb739557ededaee902b23e48a577817b4 (patch)
tree22dbfc57f04e72e2f7dfbbcc2f3dee42bf00cd0a /helix-lsp/src
parent8289bd1cb0cf34d26a9f452850081799311e3f45 (diff)
lsp: Hover documentation draft.
Diffstat (limited to 'helix-lsp/src')
-rw-r--r--helix-lsp/src/client.rs58
1 files changed, 53 insertions, 5 deletions
diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs
index b229cd1a..77e877e4 100644
--- a/helix-lsp/src/client.rs
+++ b/helix-lsp/src/client.rs
@@ -201,11 +201,12 @@ impl Client {
context_support: None, // additional context information Some(true)
..Default::default()
}),
- // { completion: {
- // dynamic_registration: bool
- // completion_item: { snippet, documentation_format, ... }
- // completion_item_kind: { }
- // } }
+ hover: Some(lsp::HoverClientCapabilities {
+ // if not specified, rust-analyzer returns plaintext marked as markdown but
+ // badly formatted.
+ content_format: Some(vec![lsp::MarkupKind::Markdown]),
+ ..Default::default()
+ }),
..Default::default()
}),
..Default::default()
@@ -458,4 +459,51 @@ impl Client {
Ok(items)
}
+
+ pub async fn text_document_signature_help(
+ &self,
+ text_document: lsp::TextDocumentIdentifier,
+ position: lsp::Position,
+ ) -> anyhow::Result<Option<lsp::SignatureHelp>> {
+ let params = lsp::SignatureHelpParams {
+ text_document_position_params: lsp::TextDocumentPositionParams {
+ text_document,
+ position,
+ },
+ // TODO: support these tokens
+ work_done_progress_params: lsp::WorkDoneProgressParams {
+ work_done_token: None,
+ },
+ context: None,
+ // lsp::SignatureHelpContext
+ };
+
+ let response = self
+ .request::<lsp::request::SignatureHelpRequest>(params)
+ .await?;
+
+ Ok(response)
+ }
+
+ pub async fn text_document_hover(
+ &self,
+ text_document: lsp::TextDocumentIdentifier,
+ position: lsp::Position,
+ ) -> anyhow::Result<Option<lsp::Hover>> {
+ let params = lsp::HoverParams {
+ text_document_position_params: lsp::TextDocumentPositionParams {
+ text_document,
+ position,
+ },
+ // TODO: support these tokens
+ work_done_progress_params: lsp::WorkDoneProgressParams {
+ work_done_token: None,
+ },
+ // lsp::SignatureHelpContext
+ };
+
+ let response = self.request::<lsp::request::HoverRequest>(params).await?;
+
+ Ok(response)
+ }
}