editor: Some more semantic highlighting perf work (#49491)

- Reduce some re-allocations in `text_anchors_to_visible_anchors` and
`refresh_semantic_tokens`
- Process `raw_to_buffer_semantic_tokens` work on the background thread

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Lukas Wirth authored and GitHub committed 2026-02-18 16:02:17 +00:00
1 parent a1af11c8c3
commit e72e9d6ce7
3 files changed
+143 -114

No files matched your search

+3 -2
View File
@@ -4109,9 +4109,10 @@ impl MultiBufferSnapshot {
&self,
anchors: impl IntoIterator<Item = text::Anchor>,
) -> Vec<Option<Anchor>> {
let anchors = anchors.into_iter();
let mut result = Vec::with_capacity(anchors.size_hint().0);
let mut anchors = anchors.peekable();
let mut cursor = self.excerpts.cursor::<Option<&Locator>>(());
let mut anchors = anchors.into_iter().peekable();
let mut result = Vec::new();
'anchors: while let Some(anchor) = anchors.peek() {
let Some(buffer_id) = anchor.buffer_id else {
anchors.next();