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/src/main_loop/handlers.rs12
1 files changed, 1 insertions, 11 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs
index 0380788ac..ca47ff5e1 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -13,7 +13,7 @@ use ra_ide::{
13 AssistId, FileId, FilePosition, FileRange, Query, Runnable, RunnableKind, SearchScope, 13 AssistId, FileId, FilePosition, FileRange, Query, Runnable, RunnableKind, SearchScope,
14}; 14};
15use ra_prof::profile; 15use ra_prof::profile;
16use ra_syntax::{tokenize, AstNode, SyntaxKind, TextRange, TextUnit}; 16use ra_syntax::{AstNode, SyntaxKind, TextRange, TextUnit};
17use rustc_hash::FxHashMap; 17use rustc_hash::FxHashMap;
18use serde::{Deserialize, Serialize}; 18use serde::{Deserialize, Serialize};
19use serde_json::to_value; 19use serde_json::to_value;
@@ -480,8 +480,6 @@ pub fn handle_prepare_rename(
480 let _p = profile("handle_prepare_rename"); 480 let _p = profile("handle_prepare_rename");
481 let position = params.try_conv_with(&world)?; 481 let position = params.try_conv_with(&world)?;
482 482
483 // We support renaming references like handle_rename does.
484 // In the future we may want to reject the renaming of things like keywords here too.
485 let optional_change = world.analysis().rename(position, "dummy")?; 483 let optional_change = world.analysis().rename(position, "dummy")?;
486 let range = match optional_change { 484 let range = match optional_change {
487 None => return Ok(None), 485 None => return Ok(None),
@@ -506,14 +504,6 @@ pub fn handle_rename(world: WorldSnapshot, params: RenameParams) -> Result<Optio
506 .into()); 504 .into());
507 } 505 }
508 506
509 // Only rename to valid identifiers
510 let tokens = tokenize(&params.new_name);
511 if tokens.len() != 1
512 || (tokens[0].kind != SyntaxKind::IDENT && tokens[0].kind != SyntaxKind::UNDERSCORE)
513 {
514 return Ok(None);
515 }
516
517 let optional_change = world.analysis().rename(position, &*params.new_name)?; 507 let optional_change = world.analysis().rename(position, &*params.new_name)?;
518 let change = match optional_change { 508 let change = match optional_change {
519 None => return Ok(None), 509 None => return Ok(None),