diff options
author | Lukas Wirth <[email protected]> | 2021-01-14 17:35:22 +0000 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-01-14 17:35:22 +0000 |
commit | f51457a643b768794092f73add6dda4aecd400a1 (patch) | |
tree | 8deeda89c7709aa69918d24ee4ecd18ea0e179db /crates/rust-analyzer/src/to_proto.rs | |
parent | f88f3d688507508ae9528101e13e1c62902467a3 (diff) |
Group file source edits by FileId
Diffstat (limited to 'crates/rust-analyzer/src/to_proto.rs')
-rw-r--r-- | crates/rust-analyzer/src/to_proto.rs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index a7ff8975a..34f510e73 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs | |||
@@ -8,8 +8,7 @@ use ide::{ | |||
8 | Assist, AssistKind, CallInfo, CompletionItem, CompletionItemKind, Documentation, FileId, | 8 | Assist, AssistKind, CallInfo, CompletionItem, CompletionItemKind, Documentation, FileId, |
9 | FileRange, FileSystemEdit, Fold, FoldKind, Highlight, HlMod, HlPunct, HlRange, HlTag, Indel, | 9 | FileRange, FileSystemEdit, Fold, FoldKind, Highlight, HlMod, HlPunct, HlRange, HlTag, Indel, |
10 | InlayHint, InlayKind, InsertTextFormat, LineIndex, Markup, NavigationTarget, ReferenceAccess, | 10 | InlayHint, InlayKind, InsertTextFormat, LineIndex, Markup, NavigationTarget, ReferenceAccess, |
11 | RenameError, Runnable, Severity, SourceChange, SourceFileEdit, SymbolKind, TextEdit, TextRange, | 11 | RenameError, Runnable, Severity, SourceChange, SymbolKind, TextEdit, TextRange, TextSize, |
12 | TextSize, | ||
13 | }; | 12 | }; |
14 | use itertools::Itertools; | 13 | use itertools::Itertools; |
15 | 14 | ||
@@ -634,13 +633,13 @@ pub(crate) fn goto_definition_response( | |||
634 | pub(crate) fn snippet_text_document_edit( | 633 | pub(crate) fn snippet_text_document_edit( |
635 | snap: &GlobalStateSnapshot, | 634 | snap: &GlobalStateSnapshot, |
636 | is_snippet: bool, | 635 | is_snippet: bool, |
637 | source_file_edit: SourceFileEdit, | 636 | file_id: FileId, |
637 | edit: TextEdit, | ||
638 | ) -> Result<lsp_ext::SnippetTextDocumentEdit> { | 638 | ) -> Result<lsp_ext::SnippetTextDocumentEdit> { |
639 | let text_document = optional_versioned_text_document_identifier(snap, source_file_edit.file_id); | 639 | let text_document = optional_versioned_text_document_identifier(snap, file_id); |
640 | let line_index = snap.analysis.file_line_index(source_file_edit.file_id)?; | 640 | let line_index = snap.analysis.file_line_index(file_id)?; |
641 | let line_endings = snap.file_line_endings(source_file_edit.file_id); | 641 | let line_endings = snap.file_line_endings(file_id); |
642 | let edits = source_file_edit | 642 | let edits = edit |
643 | .edit | ||
644 | .into_iter() | 643 | .into_iter() |
645 | .map(|it| snippet_text_edit(&line_index, line_endings, is_snippet, it)) | 644 | .map(|it| snippet_text_edit(&line_index, line_endings, is_snippet, it)) |
646 | .collect(); | 645 | .collect(); |
@@ -699,8 +698,8 @@ pub(crate) fn snippet_workspace_edit( | |||
699 | let ops = snippet_text_document_ops(snap, op); | 698 | let ops = snippet_text_document_ops(snap, op); |
700 | document_changes.extend_from_slice(&ops); | 699 | document_changes.extend_from_slice(&ops); |
701 | } | 700 | } |
702 | for edit in source_change.source_file_edits { | 701 | for (file_id, edit) in source_change.source_file_edits.edits { |
703 | let edit = snippet_text_document_edit(&snap, source_change.is_snippet, edit)?; | 702 | let edit = snippet_text_document_edit(&snap, source_change.is_snippet, file_id, edit)?; |
704 | document_changes.push(lsp_ext::SnippetDocumentChangeOperation::Edit(edit)); | 703 | document_changes.push(lsp_ext::SnippetDocumentChangeOperation::Edit(edit)); |
705 | } | 704 | } |
706 | let workspace_edit = | 705 | let workspace_edit = |