From 6df083954ca2051963921712501e3a8040ea6db3 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 10 Nov 2025 01:28:03 +0200 Subject: [PATCH] Properly select applicable ranges --- crates/editor/src/editor.rs | 1 - crates/language/src/buffer/row_chunk.rs | 13 ++++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 240125fd8a8691a52236bfee098f397518e9e1ff..4a2e43ae4f687e49dedf38c1b08746b42121d1a0 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -21087,7 +21087,6 @@ impl Editor { self.refresh_code_actions(window, cx); self.refresh_selected_text_highlights(true, window, cx); self.refresh_single_line_folds(window, cx); - self.colorize_brackets(true, cx); self.refresh_matching_bracket_highlights(window, cx); if self.has_active_edit_prediction() { self.update_visible_edit_prediction(window, cx); diff --git a/crates/language/src/buffer/row_chunk.rs b/crates/language/src/buffer/row_chunk.rs index fd1936ea39fec7512d1f6e27b3f7e177c3de069e..0542de50077c7bfff3f9907ac26f30ef827704b4 100644 --- a/crates/language/src/buffer/row_chunk.rs +++ b/crates/language/src/buffer/row_chunk.rs @@ -5,6 +5,7 @@ use std::{ops::Range, sync::Arc}; use clock::Global; use text::{Anchor, OffsetRangeExt as _, Point}; +use util::RangeExt; use crate::BufferRow; @@ -65,18 +66,16 @@ impl RowChunks { let row_ranges = ranges .iter() .map(|range| range.to_point(&self.snapshot)) - .map(|point_range| point_range.start.row..=point_range.end.row) + // Be lenient and yield multiple chunks if they "touch" the exclusive part of the range. + // This will result in LSP hints [re-]queried for more ranges, but also more hints already visible when scrolling around. .map(|point_range| point_range.start.row..point_range.end.row + 1) .collect::>(); self.chunks .iter() .filter(move |chunk| -> bool { - // Be lenient and yield multiple chunks if they "touch" the exclusive part of the range. - // This will result in LSP hints [re-]queried for more ranges, but also more hints already visible when scrolling around. let chunk_range = chunk.row_range(); - row_ranges.iter().any(|row_range| { - chunk_range.contains(&row_range.start()) - || chunk_range.contains(&row_range.end()) - }) + row_ranges + .iter() + .any(|row_range| chunk_range.overlaps(row_range)) }) .copied() }