Skip to content

Commit 2a75594

Browse files
bors[bot]Veykril
andauthored
Merge #7505
7505: Widen Highlights root range to covering element r=Veykril a=Veykril There have been a few issues about/containing spurious syntax highlighting panics, which all seem to come from the `rust_analyzer::handlers::handle_semantic_tokens_range` request, which I believe this to be the cause of as the text range we want to highlight here is currently potentially smaller than that of the covering element, so we might highlight something that is inside the covering element, but outside of the text range we wish to highlight causing the assert to fail. Unfortunately this isn't really easy to test since I have yet to find a reproducible cause(#7504 doesn't work for me cause I can't seem to checkout the given commit). See #7504, #7298, #7299 and #7416, all of those contain an assertion failure in syntax highlighting, but only in the range request. Co-authored-by: Lukas Wirth <[email protected]>
2 parents 855b00c + 34d5d77 commit 2a75594

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

crates/ide/src/syntax_highlighting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub(crate) fn highlight(
7272
}
7373
};
7474

75-
let mut hl = highlights::Highlights::new(range_to_highlight);
75+
let mut hl = highlights::Highlights::new(root.text_range());
7676
traverse(&mut hl, &sema, &root, range_to_highlight, syntactic_name_ref_highlighting);
7777
hl.to_vec()
7878
}

0 commit comments

Comments
 (0)