From e03edc2a768aa03a85c82d92441cd9134b145879 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Wed, 19 Mar 2025 18:40:31 +0100 Subject: [PATCH] debugger: Do not allow setting breakpoints in buffers without file storage (#27094) Closes #ISSUE Release Notes: - N/A --- crates/editor/src/editor.rs | 3 +++ crates/editor/src/element.rs | 23 ++++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 786d6c60d7..90f82ba458 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 5947b48ba9..c1fe9182de 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();