aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/libsyntax2/src/lib.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/crates/libsyntax2/src/lib.rs b/crates/libsyntax2/src/lib.rs
index d124d3284..7c9fbc421 100644
--- a/crates/libsyntax2/src/lib.rs
+++ b/crates/libsyntax2/src/lib.rs
@@ -100,7 +100,12 @@ impl File {
100 | RAW_STRING => { 100 | RAW_STRING => {
101 let text = get_text_after_edit(node, &edit); 101 let text = get_text_after_edit(node, &edit);
102 let tokens = tokenize(&text); 102 let tokens = tokenize(&text);
103 if tokens.len() != 1 || tokens[0].kind != node.kind() { 103 let token = match tokens[..] {
104 [token] if token.kind == node.kind() => token,
105 _ => return None,
106 };
107
108 if token.kind == IDENT && is_contextual_kw(&text) {
104 return None; 109 return None;
105 } 110 }
106 111
@@ -167,6 +172,15 @@ fn get_text_after_edit(node: SyntaxNodeRef, edit: &AtomEdit) -> String {
167 ) 172 )
168} 173}
169 174
175fn is_contextual_kw(text: &str) -> bool {
176 match text {
177 | "auto"
178 | "default"
179 | "union" => true,
180 _ => false,
181 }
182}
183
170fn find_reparsable_node(node: SyntaxNodeRef, range: TextRange) -> Option<(SyntaxNodeRef, fn(&mut Parser))> { 184fn find_reparsable_node(node: SyntaxNodeRef, range: TextRange) -> Option<(SyntaxNodeRef, fn(&mut Parser))> {
171 let node = algo::find_covering_node(node, range); 185 let node = algo::find_covering_node(node, range);
172 return algo::ancestors(node) 186 return algo::ancestors(node)