mirror of
https://github.com/zed-industries/zed.git
synced 2026-05-31 21:31:32 +00:00
Follow-up to #28671 This primarily follows two ideas: 1. We currently take the element with the highest score which appears last in the iterator (see [`last_by_key`](https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.max_by_key)), so we can also just reverse the iterator and take the first highest match instead. 2. Once we have a match with a given precedence, we are not interested in any matches with a lower or even the same priority, given what was established in 1. Thus, we also only have to check whether any language checked afterwards has a higher priority match. Furthermore, once we have a match with the highest possible precedence, there is no need to look for any more possible matches. Thus, this PR also adds short-circuiting for that scenario. Lastly, I also cleaned-up the custom suffix match (an empty glob-set will never match so no need to iterate there) as well reorder the zip-call in the content matches, as we never need the content if there is no first line pattern present for the checked languages. Release Notes: - N/A |
||
|---|---|---|
| .. | ||
| src | ||
| build.rs | ||
| Cargo.toml | ||
| LICENSE-GPL | ||