@@ -26,7 +26,7 @@ use helix_view::{
26 keyboard::{KeyCode, KeyModifiers},
26 keyboard::{KeyCode, KeyModifiers},
27 Document, Editor, Theme, View,
27 Document, Editor, Theme, View,
29−use std::borrow::Cow;
29+use std::{borrow::Cow, collections::HashMap, path::PathBuf};
31use crossterm::event::{Event, MouseButton, MouseEvent, MouseEventKind};
31use crossterm::event::{Event, MouseButton, MouseEvent, MouseEventKind};
32use tui::buffer::Buffer as Surface;
32use tui::buffer::Buffer as Surface;
@@ -76,6 +76,7 @@ impl EditorView {
76 loader: &syntax::Loader,
76 loader: &syntax::Loader,
77 config: &helix_view::editor::Config,
77 config: &helix_view::editor::Config,
78 debugger: &Option<helix_dap::Client>,
78 debugger: &Option<helix_dap::Client>,
79+ breakpoints: &HashMap<PathBuf, Vec<helix_dap::SourceBreakpoint>>,
80 let inner = view.inner_area();
81 let inner = view.inner_area();
81 let area = view.area;
82 let area = view.area;
@@ -93,7 +94,15 @@ impl EditorView {
94 Self::render_text_highlights(doc, view.offset, inner, surface, theme, highlights);
95 Self::render_text_highlights(doc, view.offset, inner, surface, theme, highlights);
95 Self::render_gutter(
96 Self::render_gutter(
96− doc, view, view.area, surface, theme, is_focused, config, debugger,
97+ doc,
99 if is_focused {
108 if is_focused {
@@ -113,7 +122,7 @@ impl EditorView {
116− self.render_diagnostics(doc, view, inner, surface, theme, debugger);
125+ self.render_diagnostics(doc, view, inner, surface, theme, breakpoints);
118 let statusline_area = view
127 let statusline_area = view
@@ -417,6 +426,7 @@ impl EditorView {
417 is_focused: bool,
426 is_focused: bool,
418 config: &helix_view::editor::Config,
427 config: &helix_view::editor::Config,
419 debugger: &Option<helix_dap::Client>,
428 debugger: &Option<helix_dap::Client>,
429+ all_breakpoints: &HashMap<PathBuf, Vec<helix_dap::SourceBreakpoint>>,
421 let text = doc.text().slice(..);
431 let text = doc.text().slice(..);
422 let last_line = view.last_line(doc);
432 let last_line = view.last_line(doc);
@@ -448,10 +458,9 @@ impl EditorView {
449 let mut breakpoints: Option<&Vec<SourceBreakpoint>> = None;
459 let mut breakpoints: Option<&Vec<SourceBreakpoint>> = None;
450 let mut stack_frame: Option<&StackFrame> = None;
460 let mut stack_frame: Option<&StackFrame> = None;
451− if let Some(debugger) = debugger {
452− if let Some(path) = doc.path() {
461+ if let Some(path) = doc.path() {
453− breakpoints = debugger.breakpoints.get(path);
462+ breakpoints = all_breakpoints.get(path);
454−
463+ if let Some(debugger) = debugger {
455 // if we have a frame, and the frame path matches document
464 // if we have a frame, and the frame path matches document
456 if let (Some(frame), Some(thread_id)) = (debugger.active_frame, debugger.thread_id)
465 if let (Some(frame), Some(thread_id)) = (debugger.active_frame, debugger.thread_id)
@@ -551,7 +560,7 @@ impl EditorView {
551 viewport: Rect,
560 viewport: Rect,
552 surface: &mut Surface,
561 surface: &mut Surface,
553 theme: &Theme,
562 theme: &Theme,
554− debugger: &Option<helix_dap::Client>,
563+ all_breakpoints: &HashMap<PathBuf, Vec<helix_dap::SourceBreakpoint>>,
556 use helix_core::diagnostic::Severity;
565 use helix_core::diagnostic::Severity;
557 use tui::{
566 use tui::{
@@ -589,26 +598,23 @@ impl EditorView {
589 lines.extend(text.lines);
598 lines.extend(text.lines);
592− if let Some(debugger) = debugger {
601+ if let Some(path) = doc.path() {
593− if let Some(path) = doc.path() {
594− if let Some(breakpoints) = debugger.breakpoints.get(path) {
602+ if let Some(breakpoints) = all_breakpoints.get(path) {
595− let line = doc.text().char_to_line(cursor);
603+ let line = doc.text().char_to_line(cursor);
596− if let Some(breakpoint) = breakpoints
604+ if let Some(breakpoint) = breakpoints
598− .find(|breakpoint| breakpoint.line - 1 == line)
606+ .find(|breakpoint| breakpoint.line - 1 == line)
600− if let Some(condition) = &breakpoint.condition {
608+ if let Some(condition) = &breakpoint.condition {
601− lines.extend(
609+ lines.extend(
602− Text::styled(condition, info.add_modifier(Modifier::UNDERLINED))
610+ Text::styled(condition, info.add_modifier(Modifier::UNDERLINED)).lines,
606− if let Some(log_message) = &breakpoint.log_message {
613+ if let Some(log_message) = &breakpoint.log_message {
607− lines.extend(
614+ lines.extend(
608− Text::styled(log_message, info.add_modifier(Modifier::UNDERLINED))
615+ Text::styled(log_message, info.add_modifier(Modifier::UNDERLINED))
@@ -1224,6 +1230,7 @@ impl Component for EditorView {
1225 &cx.editor.config,
1231 &cx.editor.config,
1226 &cx.editor.debugger,
1232 &cx.editor.debugger,
1233+ &cx.editor.breakpoints,