@@ -26,7 +26,7 @@ use helix_view::{
2626 keyboard::{KeyCode, KeyModifiers},
2727 Document, Editor, Theme, View,
2828};
29−use std::borrow::Cow;
29+use std::{borrow::Cow, collections::HashMap, path::PathBuf};
3030
3131use crossterm::event::{Event, MouseButton, MouseEvent, MouseEventKind};
3232use tui::buffer::Buffer as Surface;
@@ -76,6 +76,7 @@ impl EditorView {
7676 loader: &syntax::Loader,
7777 config: &helix_view::editor::Config,
7878 debugger: &Option<helix_dap::Client>,
79+ breakpoints: &HashMap<PathBuf, Vec<helix_dap::SourceBreakpoint>>,
7980 ) {
8081 let inner = view.inner_area();
8182 let area = view.area;
@@ -93,7 +94,15 @@ impl EditorView {
9394
9495 Self::render_text_highlights(doc, view.offset, inner, surface, theme, highlights);
9596 Self::render_gutter(
96− doc, view, view.area, surface, theme, is_focused, config, debugger,
97+ doc,
98+ view,
99+ view.area,
100+ surface,
101+ theme,
102+ is_focused,
103+ config,
104+ debugger,
105+ breakpoints,
97106 );
98107
99108 if is_focused {
@@ -113,7 +122,7 @@ impl EditorView {
113122 }
114123 }
115124
116− self.render_diagnostics(doc, view, inner, surface, theme, debugger);
125+ self.render_diagnostics(doc, view, inner, surface, theme, breakpoints);
117126
118127 let statusline_area = view
119128 .area
@@ -417,6 +426,7 @@ impl EditorView {
417426 is_focused: bool,
418427 config: &helix_view::editor::Config,
419428 debugger: &Option<helix_dap::Client>,
429+ all_breakpoints: &HashMap<PathBuf, Vec<helix_dap::SourceBreakpoint>>,
420430 ) {
421431 let text = doc.text().slice(..);
422432 let last_line = view.last_line(doc);
@@ -448,10 +458,9 @@ impl EditorView {
448458
449459 let mut breakpoints: Option<&Vec<SourceBreakpoint>> = None;
450460 let mut stack_frame: Option<&StackFrame> = None;
451− if let Some(debugger) = debugger {
452− if let Some(path) = doc.path() {
453− breakpoints = debugger.breakpoints.get(path);
454−
461+ if let Some(path) = doc.path() {
462+ breakpoints = all_breakpoints.get(path);
463+ if let Some(debugger) = debugger {
455464 // if we have a frame, and the frame path matches document
456465 if let (Some(frame), Some(thread_id)) = (debugger.active_frame, debugger.thread_id)
457466 {
@@ -551,7 +560,7 @@ impl EditorView {
551560 viewport: Rect,
552561 surface: &mut Surface,
553562 theme: &Theme,
554− debugger: &Option<helix_dap::Client>,
563+ all_breakpoints: &HashMap<PathBuf, Vec<helix_dap::SourceBreakpoint>>,
555564 ) {
556565 use helix_core::diagnostic::Severity;
557566 use tui::{
@@ -589,26 +598,23 @@ impl EditorView {
589598 lines.extend(text.lines);
590599 }
591600
592− if let Some(debugger) = debugger {
593− if let Some(path) = doc.path() {
594− if let Some(breakpoints) = debugger.breakpoints.get(path) {
595− let line = doc.text().char_to_line(cursor);
596− if let Some(breakpoint) = breakpoints
597− .iter()
598− .find(|breakpoint| breakpoint.line - 1 == line)
599− {
600− if let Some(condition) = &breakpoint.condition {
601− lines.extend(
602− Text::styled(condition, info.add_modifier(Modifier::UNDERLINED))
603− .lines,
604− );
605− }
606− if let Some(log_message) = &breakpoint.log_message {
607− lines.extend(
608− Text::styled(log_message, info.add_modifier(Modifier::UNDERLINED))
609− .lines,
610− );
611− }
601+ if let Some(path) = doc.path() {
602+ if let Some(breakpoints) = all_breakpoints.get(path) {
603+ let line = doc.text().char_to_line(cursor);
604+ if let Some(breakpoint) = breakpoints
605+ .iter()
606+ .find(|breakpoint| breakpoint.line - 1 == line)
607+ {
608+ if let Some(condition) = &breakpoint.condition {
609+ lines.extend(
610+ Text::styled(condition, info.add_modifier(Modifier::UNDERLINED)).lines,
611+ );
612+ }
613+ if let Some(log_message) = &breakpoint.log_message {
614+ lines.extend(
615+ Text::styled(log_message, info.add_modifier(Modifier::UNDERLINED))
616+ .lines,
617+ );
612618 }
613619 }
614620 }
@@ -1224,6 +1230,7 @@ impl Component for EditorView {
12241230 loader,
12251231 &cx.editor.config,
12261232 &cx.editor.debugger,
1233+ &cx.editor.breakpoints,
12271234 );
12281235 }
12291236