aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_lsp_server/src')
-rw-r--r--crates/ra_lsp_server/src/main_loop.rs2
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs21
2 files changed, 9 insertions, 14 deletions
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs
index 46b48830d..06dd373c0 100644
--- a/crates/ra_lsp_server/src/main_loop.rs
+++ b/crates/ra_lsp_server/src/main_loop.rs
@@ -433,7 +433,7 @@ impl<'a> PoolDispatcher<'a> {
433 RawResponse::err( 433 RawResponse::err(
434 id, 434 id,
435 ErrorCode::ContentModified as i32, 435 ErrorCode::ContentModified as i32,
436 format!("content modified: {:?}", e), 436 "content modified".to_string(),
437 ) 437 )
438 } else { 438 } else {
439 RawResponse::err( 439 RawResponse::err(
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs
index 228eb7ce5..012f74270 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -556,24 +556,19 @@ pub fn handle_rename(world: ServerWorld, params: RenameParams) -> Result<Option<
556 .into()); 556 .into());
557 } 557 }
558 558
559 let refs = world 559 let renames = world
560 .analysis() 560 .analysis()
561 .find_all_refs(FilePosition { file_id, offset })?; 561 .rename(FilePosition { file_id, offset }, &*params.new_name)?;
562 if refs.is_empty() { 562 if renames.is_empty() {
563 return Ok(None); 563 return Ok(None);
564 } 564 }
565 565
566 let mut changes = HashMap::new(); 566 let mut changes = HashMap::new();
567 for r in refs { 567 for edit in renames {
568 if let Ok(loc) = to_location(r.0, r.1, &world, &line_index) { 568 changes
569 changes 569 .entry(file_id.try_conv_with(&world)?)
570 .entry(loc.uri) 570 .or_insert_with(Vec::new)
571 .or_insert_with(Vec::new) 571 .extend(edit.edit.conv_with(&line_index));
572 .push(TextEdit {
573 range: loc.range,
574 new_text: params.new_name.clone(),
575 });
576 }
577 } 572 }
578 573
579 Ok(Some(WorkspaceEdit { 574 Ok(Some(WorkspaceEdit {