aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_lsp_server')
-rw-r--r--crates/ra_lsp_server/Cargo.toml6
-rw-r--r--crates/ra_lsp_server/src/main_loop.rs2
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs21
3 files changed, 12 insertions, 17 deletions
diff --git a/crates/ra_lsp_server/Cargo.toml b/crates/ra_lsp_server/Cargo.toml
index 22a26b844..8bd4caa53 100644
--- a/crates/ra_lsp_server/Cargo.toml
+++ b/crates/ra_lsp_server/Cargo.toml
@@ -8,9 +8,9 @@ authors = ["Aleksey Kladov <[email protected]>"]
8rayon = "1.0.2" 8rayon = "1.0.2"
9threadpool = "1.7.1" 9threadpool = "1.7.1"
10relative-path = "0.4.0" 10relative-path = "0.4.0"
11failure = "0.1.2" 11failure = "0.1.4"
12failure_derive = "0.1.2" 12failure_derive = "0.1.4"
13serde_json = "1.0.24" 13serde_json = "1.0.34"
14serde = "1.0.83" 14serde = "1.0.83"
15drop_bomb = "0.1.0" 15drop_bomb = "0.1.0"
16crossbeam-channel = "0.3.5" 16crossbeam-channel = "0.3.5"
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 {