aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
authorVeetaha <[email protected]>2020-01-28 05:09:13 +0000
committerVeetaha <[email protected]>2020-02-03 22:00:55 +0000
commit9e7eaa959f9dc368a55f1a80b35651b78b3d0883 (patch)
tree4b1f4af14d9898301949fa937219006d671a72ef /crates/ra_ide
parentbf60661aa3e2a77fedb3e1627675842d05538860 (diff)
ra_syntax: refactored the lexer design as per @matklad and @kiljacken PR review
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/references/rename.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs
index ad3e86f7c..9a84c1c88 100644
--- a/crates/ra_ide/src/references/rename.rs
+++ b/crates/ra_ide/src/references/rename.rs
@@ -2,7 +2,9 @@
2 2
3use hir::ModuleSource; 3use hir::ModuleSource;
4use ra_db::{RelativePath, RelativePathBuf, SourceDatabase, SourceDatabaseExt}; 4use ra_db::{RelativePath, RelativePathBuf, SourceDatabase, SourceDatabaseExt};
5use ra_syntax::{algo::find_node_at_offset, ast, single_token, AstNode, SyntaxKind, SyntaxNode}; 5use ra_syntax::{
6 algo::find_node_at_offset, ast, lex_single_valid_syntax_kind, AstNode, SyntaxKind, SyntaxNode,
7};
6use ra_text_edit::TextEdit; 8use ra_text_edit::TextEdit;
7 9
8use crate::{ 10use crate::{
@@ -17,7 +19,7 @@ pub(crate) fn rename(
17 position: FilePosition, 19 position: FilePosition,
18 new_name: &str, 20 new_name: &str,
19) -> Option<RangeInfo<SourceChange>> { 21) -> Option<RangeInfo<SourceChange>> {
20 match single_token(new_name)?.token.kind { 22 match lex_single_valid_syntax_kind(new_name)? {
21 SyntaxKind::IDENT | SyntaxKind::UNDERSCORE => (), 23 SyntaxKind::IDENT | SyntaxKind::UNDERSCORE => (),
22 _ => return None, 24 _ => return None,
23 } 25 }