on master help sign in
show breakpoint condition in diagnostics
b78f70eDmitry Sharshakov
helix-term/src/ui/editor.rs+21−1
@@ -110,7 +110,7 @@ impl EditorView {
110 }
110 }
111 }
111 }
112
112
113− self.render_diagnostics(doc, view, inner, surface, theme);
113+ self.render_diagnostics(doc, view, inner, surface, theme, debugger);
114
114
115 let area = Rect::new(
115 let area = Rect::new(
116 view.area.x,
116 view.area.x,
@@ -529,6 +529,7 @@ impl EditorView {
529 viewport: Rect,
529 viewport: Rect,
530 surface: &mut Surface,
530 surface: &mut Surface,
531 theme: &Theme,
531 theme: &Theme,
532+ debugger: &Option<helix_dap::Client>,
532 ) {
533 ) {
533 use helix_core::diagnostic::Severity;
534 use helix_core::diagnostic::Severity;
534 use tui::{
535 use tui::{
@@ -566,6 +567,25 @@ impl EditorView {
566 lines.extend(text.lines);
567 lines.extend(text.lines);
567 }
568 }
568
569
570+ if let Some(debugger) = debugger {
571+ if let Some(path) = doc.path() {
572+ if let Some(breakpoints) = debugger.breakpoints.get(path) {
573+ let line = doc.text().char_to_line(cursor);
574+ if let Some(breakpoint) = breakpoints
575+ .iter()
576+ .find(|breakpoint| breakpoint.line - 1 == line)
577+ {
578+ if let Some(condition) = &breakpoint.condition {
579+ lines.extend(
580+ Text::styled(condition, info.add_modifier(Modifier::UNDERLINED))
581+ .lines,
582+ );
583+ }
584+ }
585+ }
586+ }
587+ }
588+
569 let paragraph = Paragraph::new(lines).alignment(Alignment::Right);
589 let paragraph = Paragraph::new(lines).alignment(Alignment::Right);
570 let width = 80.min(viewport.width);
590 let width = 80.min(viewport.width);
571 let height = 15.min(viewport.height);
591 let height = 15.min(viewport.height);