editor: Fix missing background highlights in multibuffer find-all-references (#55863)

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

The root cause is in this part of code:

https://github.com/zed-industries/zed/blob/f5945344cc21ebff07eb7ea04dab0555fbe49007/crates/editor/src/editor.rs#L19446-L19464
The ranges across multibuffer are stored in the order of the HashMap
iterator, which is not sorted at all. They are then consumed by
`background_highlights_in_range()`, which uses a binary search that
requires the ranges to be sorted:

https://github.com/zed-industries/zed/blob/f5945344cc21ebff07eb7ea04dab0555fbe49007/crates/editor/src/editor.rs#L24127-L24135
The fix sorts the ranges by multibuffer anchor position before storing
them.

Release Notes:

- Fixed missing background highlights in "Find All References" when
results span multiple files.
29dc988f15Xin Zhao committed on 6/1/2026, 6:49:03 AM· committed by GitHubparentfcf45c6
1 file changedLine totals unavailable