|
|
@ -1136,20 +1136,23 @@ impl Client {
|
|
|
|
Some(self.call::<lsp::request::CodeActionRequest>(params))
|
|
|
|
Some(self.call::<lsp::request::CodeActionRequest>(params))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn supports_rename(&self) -> bool {
|
|
|
|
|
|
|
|
let capabilities = self.capabilities.get().unwrap();
|
|
|
|
|
|
|
|
matches!(
|
|
|
|
|
|
|
|
capabilities.rename_provider,
|
|
|
|
|
|
|
|
Some(lsp::OneOf::Left(true) | lsp::OneOf::Right(_))
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn rename_symbol(
|
|
|
|
pub fn rename_symbol(
|
|
|
|
&self,
|
|
|
|
&self,
|
|
|
|
text_document: lsp::TextDocumentIdentifier,
|
|
|
|
text_document: lsp::TextDocumentIdentifier,
|
|
|
|
position: lsp::Position,
|
|
|
|
position: lsp::Position,
|
|
|
|
new_name: String,
|
|
|
|
new_name: String,
|
|
|
|
) -> Option<impl Future<Output = Result<lsp::WorkspaceEdit>>> {
|
|
|
|
) -> Option<impl Future<Output = Result<lsp::WorkspaceEdit>>> {
|
|
|
|
let capabilities = self.capabilities.get().unwrap();
|
|
|
|
if !self.supports_rename() {
|
|
|
|
|
|
|
|
return None;
|
|
|
|
// Return early if the language server does not support renaming.
|
|
|
|
}
|
|
|
|
match capabilities.rename_provider {
|
|
|
|
|
|
|
|
Some(lsp::OneOf::Left(true)) | Some(lsp::OneOf::Right(_)) => (),
|
|
|
|
|
|
|
|
// None | Some(false)
|
|
|
|
|
|
|
|
_ => return None,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let params = lsp::RenameParams {
|
|
|
|
let params = lsp::RenameParams {
|
|
|
|
text_document_position: lsp::TextDocumentPositionParams {
|
|
|
|
text_document_position: lsp::TextDocumentPositionParams {
|
|
|
|