mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-27 04:44:30 +00:00
Maintain order of outline items when filling out tree's missing parts
This commit is contained in:
parent
adeb7e6864
commit
9c1f58ee89
1 changed files with 10 additions and 6 deletions
|
@ -67,6 +67,7 @@ impl<T> Outline<T> {
|
|||
*position = name_range.start as usize + (*position - preceding_ranges_len);
|
||||
}
|
||||
|
||||
let insertion_ix = tree_matches.len();
|
||||
let mut cur_depth = outline_match.depth;
|
||||
for (ix, item) in self.items[prev_item_ix..string_match.candidate_index]
|
||||
.iter()
|
||||
|
@ -79,12 +80,15 @@ impl<T> Outline<T> {
|
|||
|
||||
let candidate_index = ix + prev_item_ix;
|
||||
if item.depth == cur_depth - 1 {
|
||||
tree_matches.push(StringMatch {
|
||||
candidate_index,
|
||||
score: Default::default(),
|
||||
positions: Default::default(),
|
||||
string: Default::default(),
|
||||
});
|
||||
tree_matches.insert(
|
||||
insertion_ix,
|
||||
StringMatch {
|
||||
candidate_index,
|
||||
score: Default::default(),
|
||||
positions: Default::default(),
|
||||
string: Default::default(),
|
||||
},
|
||||
);
|
||||
cur_depth -= 1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue