diff options
Diffstat (limited to 'crates/ra_syntax/src/parsing/reparsing.rs')
-rw-r--r-- | crates/ra_syntax/src/parsing/reparsing.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/crates/ra_syntax/src/parsing/reparsing.rs b/crates/ra_syntax/src/parsing/reparsing.rs index 434f850d1..6de02a15a 100644 --- a/crates/ra_syntax/src/parsing/reparsing.rs +++ b/crates/ra_syntax/src/parsing/reparsing.rs | |||
@@ -17,7 +17,8 @@ use crate::{ | |||
17 | text_token_source::TextTokenSource, | 17 | text_token_source::TextTokenSource, |
18 | text_tree_sink::TextTreeSink, | 18 | text_tree_sink::TextTreeSink, |
19 | lexer::{tokenize, Token}, | 19 | lexer::{tokenize, Token}, |
20 | } | 20 | }, |
21 | T, | ||
21 | }; | 22 | }; |
22 | 23 | ||
23 | pub(crate) fn incremental_reparse( | 24 | pub(crate) fn incremental_reparse( |
@@ -122,16 +123,16 @@ fn find_reparsable_node(node: &SyntaxNode, range: TextRange) -> Option<(&SyntaxN | |||
122 | 123 | ||
123 | fn is_balanced(tokens: &[Token]) -> bool { | 124 | fn is_balanced(tokens: &[Token]) -> bool { |
124 | if tokens.is_empty() | 125 | if tokens.is_empty() |
125 | || tokens.first().unwrap().kind != L_CURLY | 126 | || tokens.first().unwrap().kind != T!['{'] |
126 | || tokens.last().unwrap().kind != R_CURLY | 127 | || tokens.last().unwrap().kind != T!['}'] |
127 | { | 128 | { |
128 | return false; | 129 | return false; |
129 | } | 130 | } |
130 | let mut balance = 0usize; | 131 | let mut balance = 0usize; |
131 | for t in &tokens[1..tokens.len() - 1] { | 132 | for t in &tokens[1..tokens.len() - 1] { |
132 | match t.kind { | 133 | match t.kind { |
133 | L_CURLY => balance += 1, | 134 | T!['{'] => balance += 1, |
134 | R_CURLY => { | 135 | T!['}'] => { |
135 | balance = match balance.checked_sub(1) { | 136 | balance = match balance.checked_sub(1) { |
136 | Some(b) => b, | 137 | Some(b) => b, |
137 | None => return false, | 138 | None => return false, |