aboutsummaryrefslogtreecommitdiff
path: root/helix-lsp
diff options
context:
space:
mode:
authorGokul Soumya2022-07-19 02:28:24 +0000
committerGitHub2022-07-19 02:28:24 +0000
commit791bf7e50a19bcf7612788deb7514847089cb976 (patch)
tree0bac607be8b940aed8000b77a2f4dfa2e14882b8 /helix-lsp
parent02f009921007301284cbb0db4bc36bc629088fbb (diff)
Add lsp signature help (#1755)
* Add lsp signature help * Do not move signature help popup on multiple triggers * Highlight current parameter in signature help * Auto close signature help * Position signature help above to not block completion * Update signature help on backspace/insert mode delete * Add lsp.auto-signature-help config option * Add serde default annotation for LspConfig * Show LSP inactive message only if signature help is invoked manually * Do not assume valid signature help response from LSP Malformed LSP responses are common, and these should not crash the editor. * Check signature help capability before sending request * Reuse Open enum for PositionBias in popup * Close signature popup and exit insert mode on escape * Add config to control signature help docs display * Use new Margin api in signature help * Invoke signature help on changing to insert mode
Diffstat (limited to 'helix-lsp')
-rw-r--r--helix-lsp/src/client.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs
index 9187a61e..f6cec6aa 100644
--- a/helix-lsp/src/client.rs
+++ b/helix-lsp/src/client.rs
@@ -322,6 +322,16 @@ impl Client {
content_format: Some(vec![lsp::MarkupKind::Markdown]),
..Default::default()
}),
+ signature_help: Some(lsp::SignatureHelpClientCapabilities {
+ signature_information: Some(lsp::SignatureInformationSettings {
+ documentation_format: Some(vec![lsp::MarkupKind::Markdown]),
+ parameter_information: Some(lsp::ParameterInformationSettings {
+ label_offset_support: Some(true),
+ }),
+ active_parameter_support: Some(true),
+ }),
+ ..Default::default()
+ }),
rename: Some(lsp::RenameClientCapabilities {
dynamic_registration: Some(false),
prepare_support: Some(false),
@@ -646,7 +656,12 @@ impl Client {
text_document: lsp::TextDocumentIdentifier,
position: lsp::Position,
work_done_token: Option<lsp::ProgressToken>,
- ) -> impl Future<Output = Result<Value>> {
+ ) -> Option<impl Future<Output = Result<Value>>> {
+ let capabilities = self.capabilities.get().unwrap();
+
+ // Return early if signature help is not supported
+ capabilities.signature_help_provider.as_ref()?;
+
let params = lsp::SignatureHelpParams {
text_document_position_params: lsp::TextDocumentPositionParams {
text_document,
@@ -657,7 +672,7 @@ impl Client {
// lsp::SignatureHelpContext
};
- self.call::<lsp::request::SignatureHelpRequest>(params)
+ Some(self.call::<lsp::request::SignatureHelpRequest>(params))
}
pub fn text_document_hover(