aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/syntax_highlighting.rs
diff options
context:
space:
mode:
authorLeander Tentrup <[email protected]>2020-04-06 22:00:09 +0100
committerLeander Tentrup <[email protected]>2020-04-06 22:00:09 +0100
commitbf96d46fee1242ad701cb037a03c9575e84221b1 (patch)
treebd01242f4e504b25d07a3d193b6715443f7b2b86 /crates/ra_ide/src/syntax_highlighting.rs
parentbb45aca9093ffe61cf444d538b3de737117c9a64 (diff)
Simplify HTML highlighter and add test case for highlight_injection logic
Diffstat (limited to 'crates/ra_ide/src/syntax_highlighting.rs')
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs
index eb1c54639..7d908f987 100644
--- a/crates/ra_ide/src/syntax_highlighting.rs
+++ b/crates/ra_ide/src/syntax_highlighting.rs
@@ -174,7 +174,13 @@ pub(crate) fn highlight(
174 } 174 }
175 175
176 assert_eq!(res.len(), 1, "after DFS traversal, the stack should only contain a single element"); 176 assert_eq!(res.len(), 1, "after DFS traversal, the stack should only contain a single element");
177 res.pop().unwrap() 177 let res = res.pop().unwrap();
178 // Check that ranges are sorted and disjoint
179 assert!(res
180 .iter()
181 .zip(res.iter().skip(1))
182 .all(|(left, right)| left.range.end() <= right.range.start()));
183 res
178} 184}
179 185
180fn macro_call_range(macro_call: &ast::MacroCall) -> Option<TextRange> { 186fn macro_call_range(macro_call: &ast::MacroCall) -> Option<TextRange> {