diff options
Diffstat (limited to 'crates/ra_lsp_server/src/main_loop')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index c010a6ddf..9cdca82c4 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs | |||
@@ -5,7 +5,7 @@ use lsp_types::{ | |||
5 | FoldingRangeKind, FoldingRangeParams, Hover, HoverContents, Location, MarkupContent, | 5 | FoldingRangeKind, FoldingRangeParams, Hover, HoverContents, Location, MarkupContent, |
6 | MarkupKind, ParameterInformation, ParameterLabel, Position, PrepareRenameResponse, Range, | 6 | MarkupKind, ParameterInformation, ParameterLabel, Position, PrepareRenameResponse, Range, |
7 | RenameParams, SignatureInformation, SymbolInformation, TextDocumentIdentifier, TextEdit, | 7 | RenameParams, SignatureInformation, SymbolInformation, TextDocumentIdentifier, TextEdit, |
8 | WorkspaceEdit, DocumentChanges, TextDocumentEdit, DocumentChangeOperation, ResourceOp | 8 | WorkspaceEdit |
9 | }; | 9 | }; |
10 | use ra_ide_api::{ | 10 | use ra_ide_api::{ |
11 | FileId, FilePosition, FileRange, FoldKind, Query, RangeInfo, RunnableKind, Severity, | 11 | FileId, FilePosition, FileRange, FoldKind, Query, RangeInfo, RunnableKind, Severity, |
@@ -472,37 +472,9 @@ pub fn handle_rename(world: ServerWorld, params: RenameParams) -> Result<Option< | |||
472 | return Ok(None); | 472 | return Ok(None); |
473 | } | 473 | } |
474 | 474 | ||
475 | let mut source_change = change.unwrap(); | 475 | let source_change_req = change.unwrap().try_conv_with(&world)?; |
476 | let text_document_edits = source_change | ||
477 | .source_file_edits | ||
478 | .drain(..) | ||
479 | .into_iter() | ||
480 | .map(|e| e.try_conv_with(&world)) | ||
481 | .collect::<Result<Vec<TextDocumentEdit>>>(); | ||
482 | |||
483 | let text_document_ops = source_change | ||
484 | .file_system_edits | ||
485 | .drain(..) | ||
486 | .into_iter() | ||
487 | .map(|e| e.try_conv_with(&world)) | ||
488 | .collect::<Result<Vec<ResourceOp>>>(); | ||
489 | |||
490 | let mut document_changes = Vec::new(); | ||
491 | document_changes.extend( | ||
492 | text_document_edits? | ||
493 | .into_iter() | ||
494 | .map(DocumentChangeOperation::Edit), | ||
495 | ); | ||
496 | document_changes.extend( | ||
497 | text_document_ops? | ||
498 | .into_iter() | ||
499 | .map(DocumentChangeOperation::Op), | ||
500 | ); | ||
501 | 476 | ||
502 | Ok(Some(WorkspaceEdit { | 477 | Ok(Some(source_change_req.workspace_edit)) |
503 | changes: None, | ||
504 | document_changes: Some(DocumentChanges::Operations(document_changes)), | ||
505 | })) | ||
506 | } | 478 | } |
507 | 479 | ||
508 | pub fn handle_references( | 480 | pub fn handle_references( |