diff options
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/parsing/reparsing.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/parsing/reparsing.rs b/crates/ra_syntax/src/parsing/reparsing.rs index b44cca49d..3b5471bf8 100644 --- a/crates/ra_syntax/src/parsing/reparsing.rs +++ b/crates/ra_syntax/src/parsing/reparsing.rs | |||
@@ -33,10 +33,10 @@ pub(crate) fn incremental_reparse( | |||
33 | } | 33 | } |
34 | 34 | ||
35 | fn reparse_leaf<'node>( | 35 | fn reparse_leaf<'node>( |
36 | node: &'node SyntaxNode, | 36 | root: &'node SyntaxNode, |
37 | edit: &AtomTextEdit, | 37 | edit: &AtomTextEdit, |
38 | ) -> Option<(&'node SyntaxNode, GreenNode, Vec<SyntaxError>)> { | 38 | ) -> Option<(&'node SyntaxNode, GreenNode, Vec<SyntaxError>)> { |
39 | let node = algo::find_covering_node(node, 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 | let text = get_text_after_edit(node, &edit); | 42 | let text = get_text_after_edit(node, &edit); |
@@ -50,6 +50,13 @@ fn reparse_leaf<'node>( | |||
50 | return None; | 50 | return None; |
51 | } | 51 | } |
52 | 52 | ||
53 | if let Some(next_char) = root.text().char_at(node.range().end()) { | ||
54 | let tokens_with_next_char = tokenize(&format!("{}{}", text, next_char)); | ||
55 | if tokens_with_next_char.len() == 1 { | ||
56 | return None; | ||
57 | } | ||
58 | } | ||
59 | |||
53 | let green = GreenNode::new_leaf(node.kind(), text.into()); | 60 | let green = GreenNode::new_leaf(node.kind(), text.into()); |
54 | let new_errors = vec![]; | 61 | let new_errors = vec![]; |
55 | Some((node, green, new_errors)) | 62 | Some((node, green, new_errors)) |