mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Simplify HTML highlighter and add test case for highlight_injection logic
This commit is contained in:
parent
bb45aca909
commit
bf96d46fee
5 changed files with 95 additions and 57 deletions
|
@ -174,7 +174,13 @@ pub(crate) fn highlight(
|
|||
}
|
||||
|
||||
assert_eq!(res.len(), 1, "after DFS traversal, the stack should only contain a single element");
|
||||
res.pop().unwrap()
|
||||
let res = res.pop().unwrap();
|
||||
// Check that ranges are sorted and disjoint
|
||||
assert!(res
|
||||
.iter()
|
||||
.zip(res.iter().skip(1))
|
||||
.all(|(left, right)| left.range.end() <= right.range.start()));
|
||||
res
|
||||
}
|
||||
|
||||
fn macro_call_range(macro_call: &ast::MacroCall) -> Option<TextRange> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue