@@ -1,6 +1,5 @@
11use super::{align_view, Align, Context, Editor};
22use crate::{
3− commands,
43 compositor::Compositor,
54 job::Callback,
65 ui::{self, FilePicker, Picker, Popup, Prompt, PromptEvent, Text},
@@ -161,6 +160,22 @@ fn thread_picker(cx: &mut Context, callback_fn: impl Fn(&mut Editor, &dap::Threa
161160 cx.push_layer(Box::new(picker))
162161}
163162
163+fn get_breakpoint_at_current_line(editor: &mut Editor) -> Option<(usize, Breakpoint)> {
164+ let (view, doc) = current!(editor);
165+ let text = doc.text().slice(..);
166+
167+ let pos = doc.selection(view.id).primary().cursor(text);
168+ let line = text.char_to_line(pos);
169+ let path = match doc.path() {
170+ Some(path) => path,
171+ None => return None,
172+ };
173+ editor.breakpoints.get(path).and_then(|breakpoints| {
174+ let i = breakpoints.iter().position(|b| b.line == line);
175+ i.map(|i| (i, breakpoints[i].clone()))
176+ })
177+}
178+
164179// -- DAP
165180
166181pub fn dap_start_impl(
@@ -381,7 +396,7 @@ fn debug_parameter_prompt(
381396 });
382397 cx.jobs.callback(callback);
383398 } else {
384− commands::dap_start_impl(
399+ dap_start_impl(
385400 cx.editor,
386401 Some(&config_name),
387402 None,
@@ -679,7 +694,7 @@ pub fn dap_disable_exceptions(cx: &mut Context) {
679694
680695// TODO: both edit condition and edit log need to be stable: we might get new breakpoints from the debugger which can change offsets
681696pub fn dap_edit_condition(cx: &mut Context) {
682− if let Some((pos, breakpoint)) = commands::cmd::get_breakpoint_at_current_line(cx.editor) {
697+ if let Some((pos, breakpoint)) = get_breakpoint_at_current_line(cx.editor) {
683698 let path = match doc!(cx.editor).path() {
684699 Some(path) => path.clone(),
685700 None => return,
@@ -726,7 +741,7 @@ pub fn dap_edit_condition(cx: &mut Context) {
726741}
727742
728743pub fn dap_edit_log(cx: &mut Context) {
729− if let Some((pos, breakpoint)) = commands::cmd::get_breakpoint_at_current_line(cx.editor) {
744+ if let Some((pos, breakpoint)) = get_breakpoint_at_current_line(cx.editor) {
730745 let path = match doc!(cx.editor).path() {
731746 Some(path) => path.clone(),
732747 None => return,