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.

debugger: Do not allow setting breakpoints in buffers without file storage (#27094)

Piotr Osiewicze03edc2a768a
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index 786d6c60d74..90f82ba4588 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -6052,6 +6052,9 @@ impl Editor {
continue;
};
+ if buffer.read(cx).file().is_none() {
+ continue;
+ }
let breakpoints = breakpoint_store.read(cx).breakpoints(
&buffer,
Some(info.range.context.start..info.range.context.end),
diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs
index 5947b48ba9a..c1fe9182dee 100644
--- a/crates/editor/src/element.rs
+++ b/crates/editor/src/element.rs
@@ -890,15 +890,24 @@ impl EditorElement {
let modifiers = event.modifiers;
let gutter_hovered = gutter_hitbox.is_hovered(window);
editor.set_gutter_hovered(gutter_hovered, cx);
+ editor.gutter_breakpoint_indicator = None;
if gutter_hovered {
- editor.gutter_breakpoint_indicator = Some(
- position_map
- .point_for_position(event.position)
- .previous_valid,
- );
- } else {
- editor.gutter_breakpoint_indicator = None;
+ let new_point = position_map
+ .point_for_position(event.position)
+ .previous_valid;
+ let buffer_anchor = position_map
+ .snapshot
+ .display_point_to_anchor(new_point, Bias::Left);
+
+ if position_map
+ .snapshot
+ .buffer_snapshot
+ .buffer_for_excerpt(buffer_anchor.excerpt_id)
+ .is_some_and(|buffer| buffer.file().is_some())
+ {
+ editor.gutter_breakpoint_indicator = Some(new_point);
+ }
}
cx.notify();