diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_syntax/src/parsing/reparsing.rs | 7 | ||||
-rw-r--r-- | crates/ra_syntax/tests/data/reparse/fuzz-failures/0005.rs | 7 |
2 files changed, 14 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[..] { |
diff --git a/crates/ra_syntax/tests/data/reparse/fuzz-failures/0005.rs b/crates/ra_syntax/tests/data/reparse/fuzz-failures/0005.rs new file mode 100644 index 000000000..074d761c7 --- /dev/null +++ b/crates/ra_syntax/tests/data/reparse/fuzz-failures/0005.rs | |||
@@ -0,0 +1,7 @@ | |||
1 | 05 | ||
2 | 1 | ||
3 | |||
4 | |||
5 | |||
6 | b' | ||
7 | \ No newline at end of file | ||