aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
authorpcpthm <[email protected]>2019-03-21 20:29:27 +0000
committerpcpthm <[email protected]>2019-03-21 23:09:11 +0000
commitbf8e7930daa3fb168106534b1cc418f5bc44e8c0 (patch)
treee4dcb3136cedf4df5c56e65f98f6eff0e2256274 /crates/ra_syntax/src
parentedbc18516d211c8dbf07539358c7d8aeca24bb30 (diff)
Fix reparsing failure when removing newline
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r--crates/ra_syntax/src/parsing/reparsing.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/parsing/reparsing.rs b/crates/ra_syntax/src/parsing/reparsing.rs
index d54669a95..7e7f914f5 100644
--- a/crates/ra_syntax/src/parsing/reparsing.rs
+++ b/crates/ra_syntax/src/parsing/reparsing.rs
@@ -39,6 +39,13 @@ fn reparse_leaf<'node>(
39 let node = algo::find_covering_node(root, edit.delete); 39 let node = algo::find_covering_node(root, edit.delete);
40 match node.kind() { 40 match node.kind() {
41 WHITESPACE | COMMENT | IDENT | STRING | RAW_STRING => { 41 WHITESPACE | COMMENT | IDENT | STRING | RAW_STRING => {
42 if node.kind() == WHITESPACE || node.kind() == COMMENT {
43 // removing a new line may extends previous token
44 if node.text().to_string()[edit.delete - node.range().start()].contains('\n') {
45 return None;
46 }
47 }
48
42 let text = get_text_after_edit(node, &edit); 49 let text = get_text_after_edit(node, &edit);
43 let tokens = tokenize(&text); 50 let tokens = tokenize(&text);
44 let token = match tokens[..] { 51 let token = match tokens[..] {