Allow specifying a custom limit for /search results (#12423)

<img width="497" alt="image"
src="https://github.com/zed-industries/zed/assets/482957/94e94326-fb3c-4f9b-b4d9-7dd6f6f8d537">


e.g.

```
/search --9 foobar
```

Release Notes:

- N/A
This commit is contained in:
Antonio Scandurra 2024-05-29 14:11:05 +02:00 committed by GitHub
parent f3e6a0beab
commit a0644ac601
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 93 additions and 49 deletions

View file

@ -44,6 +44,11 @@ impl SyntaxTheme {
self.get(name).color.unwrap_or_default()
}
pub fn highlight_id(&self, name: &str) -> Option<u32> {
let ix = self.highlights.iter().position(|entry| entry.0 == name)?;
Some(ix as u32)
}
/// Returns a new [`Arc<SyntaxTheme>`] with the given syntax styles merged in.
pub fn merge(base: Arc<Self>, user_syntax_styles: Vec<(String, HighlightStyle)>) -> Arc<Self> {
if user_syntax_styles.is_empty() {