diff options
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/parsing/reparsing.rs | 7 |
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[..] { |