diff options
author | CossonLeo | 2021-11-08 15:17:54 +0000 |
---|---|---|
committer | GitHub | 2021-11-08 15:17:54 +0000 |
commit | 29e684941389f949491efe4d9807a0edd1facee3 (patch) | |
tree | 118f252ae10aff36a91361c16aef4b33c6aac2b2 /helix-lsp/src | |
parent | bf4c70e02739601b7657c69a3876f9d1090a42c0 (diff) |
Add LSP rename_symbol (space-r) (#1011)
improve apply_workspace_edit
Diffstat (limited to 'helix-lsp/src')
-rw-r--r-- | helix-lsp/src/client.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index b810feef..271fd9d5 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -257,6 +257,12 @@ impl Client { content_format: Some(vec![lsp::MarkupKind::Markdown]), ..Default::default() }), + rename: Some(lsp::RenameClientCapabilities { + dynamic_registration: Some(false), + prepare_support: Some(false), + prepare_support_default_behavior: None, + honors_change_annotations: Some(false), + }), code_action: Some(lsp::CodeActionClientCapabilities { code_action_literal_support: Some(lsp::CodeActionLiteralSupport { code_action_kind: lsp::CodeActionKindLiteralSupport { @@ -773,4 +779,25 @@ impl Client { self.call::<lsp::request::CodeActionRequest>(params) } + + pub async fn rename_symbol( + &self, + text_document: lsp::TextDocumentIdentifier, + position: lsp::Position, + new_name: String, + ) -> anyhow::Result<lsp::WorkspaceEdit> { + let params = lsp::RenameParams { + text_document_position: lsp::TextDocumentPositionParams { + text_document, + position, + }, + new_name, + work_done_progress_params: lsp::WorkDoneProgressParams { + work_done_token: None, + }, + }; + + let response = self.request::<lsp::request::Rename>(params).await?; + Ok(response.unwrap_or_default()) + } } |