Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Use proper inlay hint range when filtering out hints (#41363)
Kirill Bulatov5423fafc83fd
diff --git a/crates/editor/src/inlays/inlay_hints.rs b/crates/editor/src/inlays/inlay_hints.rsindex 3aab7be8207..2cbea33932d 100644--- a/crates/editor/src/inlays/inlay_hints.rs+++ b/crates/editor/src/inlays/inlay_hints.rs@@ -344,7 +344,7 @@ impl Editor {.extend(invalidate_hints_for_buffers);let mut buffers_to_query = HashMap::default();- for (excerpt_id, (buffer, buffer_version, visible_range)) in visible_excerpts {+ for (_, (buffer, buffer_version, visible_range)) in visible_excerpts {let buffer_id = buffer.read(cx).remote_id();if !self.registered_buffers.contains_key(&buffer_id) {continue;@@ -358,13 +358,11 @@ impl Editor {buffers_to_query.entry(buffer_id).or_insert_with(|| VisibleExcerpts {- excerpts: Vec::new(),ranges: Vec::new(),buffer_version: buffer_version.clone(),buffer: buffer.clone(),});visible_excerpts.buffer_version = buffer_version;- visible_excerpts.excerpts.push(excerpt_id);visible_excerpts.ranges.push(buffer_anchor_range);}@@ -850,7 +848,6 @@ impl Editor {#[derive(Debug)]struct VisibleExcerpts {- excerpts: Vec<ExcerptId>,ranges: Vec<Range<text::Anchor>>,buffer_version: Global,buffer: Entity<language::Buffer>,@@ -2017,7 +2014,7 @@ pub mod tests {task_lsp_request_ranges.lock().push(params.range);task_lsp_request_count.fetch_add(1, Ordering::Release);Ok(Some(vec![lsp::InlayHint {- position: params.range.end,+ position: params.range.start,label: lsp::InlayHintLabel::String(params.range.end.line.to_string(),),diff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rsindex faf53fa802c..139ac25fe78 100644--- a/crates/project/src/lsp_store.rs+++ b/crates/project/src/lsp_store.rs@@ -6844,7 +6844,7 @@ impl LspStore {&& range.start.is_valid(&buffer_snapshot)&& range.end.is_valid(&buffer_snapshot)&& hint.position.cmp(&range.start, &buffer_snapshot).is_ge()- && hint.position.cmp(&range.end, &buffer_snapshot).is_le()+ && hint.position.cmp(&range.end, &buffer_snapshot).is_lt()});(server_id, new_hints)})