Helper: send a rename request and return the workspace edit.
(
backend: &Backend,
uri: &Url,
line: u32,
character: u32,
new_name: &str,
)
| 34 | |
| 35 | /// Helper: send a rename request and return the workspace edit. |
| 36 | async fn rename( |
| 37 | backend: &Backend, |
| 38 | uri: &Url, |
| 39 | line: u32, |
| 40 | character: u32, |
| 41 | new_name: &str, |
| 42 | ) -> Option<WorkspaceEdit> { |
| 43 | let params = RenameParams { |
| 44 | text_document_position: TextDocumentPositionParams { |
| 45 | text_document: TextDocumentIdentifier { uri: uri.clone() }, |
| 46 | position: Position { line, character }, |
| 47 | }, |
| 48 | new_name: new_name.to_string(), |
| 49 | work_done_progress_params: WorkDoneProgressParams::default(), |
| 50 | }; |
| 51 | |
| 52 | backend.rename(params).await.unwrap() |
| 53 | } |
| 54 | |
| 55 | /// Collect all text edits for a given URI from a WorkspaceEdit. |
| 56 | fn edits_for_uri(edit: &WorkspaceEdit, uri: &Url) -> Vec<TextEdit> { |
no test coverage detected