diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-02-05 15:31:25 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-02-05 15:31:25 +0000 |
commit | 2a75594ee894baad5339ff9708ca70f6f69e0a36 (patch) | |
tree | abd96da79edf04649b41c4ea8eb61e9b01123c47 /crates/ide | |
parent | 855b00cbe600cad34a14841c37a2ac1f2f3a247e (diff) | |
parent | 34d5d77cfa09f4460a0851b5650f441771e7373e (diff) |
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]>
Diffstat (limited to 'crates/ide')
-rw-r--r-- | crates/ide/src/syntax_highlighting.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index a3d4e4f77..9bed329d8 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs | |||
@@ -72,7 +72,7 @@ pub(crate) fn highlight( | |||
72 | } | 72 | } |
73 | }; | 73 | }; |
74 | 74 | ||
75 | let mut hl = highlights::Highlights::new(range_to_highlight); | 75 | let mut hl = highlights::Highlights::new(root.text_range()); |
76 | traverse(&mut hl, &sema, &root, range_to_highlight, syntactic_name_ref_highlighting); | 76 | traverse(&mut hl, &sema, &root, range_to_highlight, syntactic_name_ref_highlighting); |
77 | hl.to_vec() | 77 | hl.to_vec() |
78 | } | 78 | } |