diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-22 13:08:45 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-22 13:08:45 +0000 |
commit | d4fa6721afacec78a750df1bb1f0e7e950eaf73c (patch) | |
tree | efabf84f708868484e0dac7893f77ddfba6d9c21 /crates/rust-analyzer/src/to_proto.rs | |
parent | 3af1885bd2c4d3470d203a216488946ee8572970 (diff) | |
parent | d331155f8db056a0f7a406498c96f759f620d2c7 (diff) |
Merge #8054
8054: Item movers r=matklad a=ivan770
Closes #6823
https://user-images.githubusercontent.com/14003886/111331579-b4f43480-8679-11eb-9af0-e4dabacc4923.mp4
Implementation issues:
- [ ] Most of items are non-movable, since _movability_ of any item has to be determined manually. Common ones are movable though
- [x] Cursor should move with the item
Co-authored-by: ivan770 <[email protected]>
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 c1ca7ff9b..25169005f 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, |