diff options
Diffstat (limited to 'crates/rust-analyzer/src/to_proto.rs')
-rw-r--r-- | crates/rust-analyzer/src/to_proto.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index 70501618e..3171708d5 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs | |||
@@ -658,6 +658,18 @@ pub(crate) fn goto_definition_response( | |||
658 | } | 658 | } |
659 | } | 659 | } |
660 | 660 | ||
661 | pub(crate) fn text_document_edit( | ||
662 | snap: &GlobalStateSnapshot, | ||
663 | file_id: FileId, | ||
664 | edit: TextEdit, | ||
665 | ) -> Result<lsp_types::TextDocumentEdit> { | ||
666 | let text_document = optional_versioned_text_document_identifier(snap, file_id); | ||
667 | let line_index = snap.file_line_index(file_id)?; | ||
668 | let edits = | ||
669 | edit.into_iter().map(|it| lsp_types::OneOf::Left(text_edit(&line_index, it))).collect(); | ||
670 | Ok(lsp_types::TextDocumentEdit { text_document, edits }) | ||
671 | } | ||
672 | |||
661 | pub(crate) fn snippet_text_document_edit( | 673 | pub(crate) fn snippet_text_document_edit( |
662 | snap: &GlobalStateSnapshot, | 674 | snap: &GlobalStateSnapshot, |
663 | is_snippet: bool, | 675 | is_snippet: bool, |