Skip to content

Commit d1d7513

Browse files
committed
Make autocomplete more flexible
- Stop taking 25, the filtering will lead to a max of 25 being shown anyway. - use contains() instead of starts_with() to allow for more flexible searching
1 parent ac71ae2 commit d1d7513

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

src/commands/snippets.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@ async fn autocomplete_snippet<'a>(
2020
.unwrap()
2121
.snippets
2222
.iter()
23-
.take(25)
2423
.map(|s| format!("{}: {}", s.id, s.title))
2524
.collect()
2625
};
2726

2827
futures::stream::iter(snippet_list)
29-
.filter(move |name| futures::future::ready(name.starts_with(partial)))
28+
.filter(move |name| futures::future::ready(name.contains(partial)))
3029
.map(|name| name.to_string())
3130
}
3231

src/commands/utils.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ async fn autocomplete_key<'a>(
1919
.unwrap()
2020
.issue_prefixes
2121
.iter()
22-
.take(25)
2322
.map(|s| s.0.clone())
2423
.collect()
2524
};
2625

2726
futures::stream::iter(snippet_list)
28-
.filter(move |name| futures::future::ready(name.starts_with(partial)))
27+
.filter(move |name| futures::future::ready(name.contains(partial)))
2928
.map(|name| name.to_string())
3029
}
3130

0 commit comments

Comments
 (0)