diff options
Diffstat (limited to 'helix-lsp/src')
-rw-r--r-- | helix-lsp/src/client.rs | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index 95f3ea34..9fa118fb 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -359,7 +359,7 @@ impl Client { }), rename: Some(lsp::RenameClientCapabilities { dynamic_registration: Some(false), - prepare_support: Some(false), + prepare_support: Some(true), prepare_support_default_behavior: None, honors_change_annotations: Some(false), }), @@ -1034,6 +1034,29 @@ impl Client { Some(self.call::<lsp::request::DocumentSymbolRequest>(params)) } + pub fn prepare_rename( + &self, + text_document: lsp::TextDocumentIdentifier, + position: lsp::Position, + ) -> Option<impl Future<Output = Result<Value>>> { + let capabilities = self.capabilities.get().unwrap(); + + match capabilities.rename_provider { + Some(lsp::OneOf::Right(lsp::RenameOptions { + prepare_provider: Some(true), + .. + })) => (), + _ => return None, + } + + let params = lsp::TextDocumentPositionParams { + text_document, + position, + }; + + Some(self.call::<lsp::request::PrepareRenameRequest>(params)) + } + // empty string to get all symbols pub fn workspace_symbols(&self, query: String) -> Option<impl Future<Output = Result<Value>>> { let capabilities = self.capabilities.get().unwrap(); |