Fix reparsing failure when removing newline
This commit is contained in:
parent
edbc18516d
commit
bf8e7930da
@ -39,6 +39,13 @@ fn reparse_leaf<'node>(
|
||||
let node = algo::find_covering_node(root, edit.delete);
|
||||
match node.kind() {
|
||||
WHITESPACE | COMMENT | IDENT | STRING | RAW_STRING => {
|
||||
if node.kind() == WHITESPACE || node.kind() == COMMENT {
|
||||
// removing a new line may extends previous token
|
||||
if node.text().to_string()[edit.delete - node.range().start()].contains('\n') {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
||||
let text = get_text_after_edit(node, &edit);
|
||||
let tokens = tokenize(&text);
|
||||
let token = match tokens[..] {
|
||||
|
@ -0,0 +1,7 @@
|
||||
05
|
||||
1
|
||||
|
||||
|
||||
|
||||
b'
|
||||
|
Loading…
Reference in New Issue
Block a user