mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-24 02:46:43 +00:00
parent
af50261ae2
commit
53c9af3e61
3 changed files with 7 additions and 14 deletions
|
@ -160,12 +160,7 @@ impl CompletionsMenu {
|
||||||
let match_candidates = completions
|
let match_candidates = completions
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(id, completion)| {
|
.map(|(id, completion)| StringMatchCandidate::new(id, &completion.label.filter_text()))
|
||||||
StringMatchCandidate::new(
|
|
||||||
id,
|
|
||||||
&completion.label.text[completion.label.filter_range.clone()],
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
|
|
@ -1678,6 +1678,10 @@ impl CodeLabel {
|
||||||
pub fn text(&self) -> &str {
|
pub fn text(&self) -> &str {
|
||||||
self.text.as_str()
|
self.text.as_str()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn filter_text(&self) -> &str {
|
||||||
|
&self.text[self.filter_range.clone()]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<String> for CodeLabel {
|
impl From<String> for CodeLabel {
|
||||||
|
|
|
@ -78,10 +78,7 @@ impl ProjectSymbolsDelegate {
|
||||||
));
|
));
|
||||||
let sort_key_for_match = |mat: &StringMatch| {
|
let sort_key_for_match = |mat: &StringMatch| {
|
||||||
let symbol = &self.symbols[mat.candidate_id];
|
let symbol = &self.symbols[mat.candidate_id];
|
||||||
(
|
(Reverse(OrderedFloat(mat.score)), symbol.label.filter_text())
|
||||||
Reverse(OrderedFloat(mat.score)),
|
|
||||||
&symbol.label.text[symbol.label.filter_range.clone()],
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
visible_matches.sort_unstable_by_key(sort_key_for_match);
|
visible_matches.sort_unstable_by_key(sort_key_for_match);
|
||||||
|
@ -177,10 +174,7 @@ impl PickerDelegate for ProjectSymbolsDelegate {
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(id, symbol)| {
|
.map(|(id, symbol)| {
|
||||||
StringMatchCandidate::new(
|
StringMatchCandidate::new(id, &symbol.label.filter_text())
|
||||||
id,
|
|
||||||
&symbol.label.text[symbol.label.filter_range.clone()],
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
.partition(|candidate| {
|
.partition(|candidate| {
|
||||||
project
|
project
|
||||||
|
|
Loading…
Reference in a new issue