From 9a2fd184256e5b6b8df01dab240198f7904ace28 Mon Sep 17 00:00:00 2001 From: Julia Date: Mon, 4 Dec 2023 15:37:34 -0500 Subject: [PATCH] Avoid panic with outline highlight ranges Previously we were using a function in `editor` to combine syntax highlighting and fuzzy match positions, it would operate on the full text as put into the label. However we now have a method `ranges` on `StringMatch` itself which operates on just the match text. The outline view has some pretty specific behavior around path/normal matches and how they are highlighted. So let's just give the match the full text before it leaves the search function so it can freely index --- crates/language2/src/outline.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/language2/src/outline.rs b/crates/language2/src/outline.rs index 4bcbdcd27f..df1a3c629e 100644 --- a/crates/language2/src/outline.rs +++ b/crates/language2/src/outline.rs @@ -81,6 +81,7 @@ impl Outline { let mut prev_item_ix = 0; for mut string_match in matches { let outline_match = &self.items[string_match.candidate_id]; + string_match.string = outline_match.text.clone(); if is_path_query { let prefix_len = self.path_candidate_prefixes[string_match.candidate_id];