Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

editor: Enable diagnostics underlines in split editors (#54295)

Lukas Wirth634e91bdace3
diff --git a/crates/editor/src/split.rs b/crates/editor/src/split.rs
index ee155830721..b613f28df95 100644
--- a/crates/editor/src/split.rs
+++ b/crates/editor/src/split.rs
@@ -483,7 +483,7 @@ impl SplittableEditor {
Editor::for_multibuffer(rhs_multibuffer.clone(), Some(project.clone()), window, cx);
editor.set_expand_all_diff_hunks(cx);
editor.disable_runnables();
- editor.disable_diagnostics(cx);
+ editor.disable_inline_diagnostics();
editor.set_minimap_visibility(crate::MinimapVisibility::Disabled, window, cx);
editor
});
diff --git a/crates/multi_buffer/src/multi_buffer.rs b/crates/multi_buffer/src/multi_buffer.rs
index 724f659e44e..16d748dc3d9 100644
--- a/crates/multi_buffer/src/multi_buffer.rs
+++ b/crates/multi_buffer/src/multi_buffer.rs
@@ -5264,12 +5264,11 @@ impl MultiBufferSnapshot {
/// Creates a multibuffer anchor for the given buffer anchor, if it is contained in any excerpt.
pub fn anchor_in_excerpt(&self, text_anchor: text::Anchor) -> Option<Anchor> {
- for excerpt in {
- let this = &self;
+ let excerpts = {
let buffer_id = text_anchor.buffer_id;
- if let Some(buffer_state) = this.buffers.get(&buffer_id) {
+ if let Some(buffer_state) = self.buffers.get(&buffer_id) {
let path_key = buffer_state.path_key.clone();
- let mut cursor = this.excerpts.cursor::<PathKey>(());
+ let mut cursor = self.excerpts.cursor::<PathKey>(());
cursor.seek_forward(&path_key, Bias::Left);
Some(iter::from_fn(move || {
let excerpt = cursor.item()?;
@@ -5284,7 +5283,8 @@ impl MultiBufferSnapshot {
}
.into_iter()
.flatten()
- } {
+ };
+ for excerpt in excerpts {
let buffer_snapshot = excerpt.buffer_snapshot(self);
if excerpt.range.contains(&text_anchor, &buffer_snapshot) {
return Some(Anchor::in_buffer(excerpt.path_key_index, text_anchor));