on master help sign in
show breakpoint condition in diagnostics
commitb78f70e602161328c0fc5954e1b6fb518b8bcec4 authorDmitry Sharshakov <d3dx12.xx@gmail.com> dateSun 22 Aug 2021, 15:52 (5 years ago) parent53ee57f
1 file changed+21−1
helix-term/src/ui/editor.rs+21−1
helix-term/src/ui/editor.rs+21−1
@@ -110,7 +110,7 @@ impl EditorView {
110110 }
111111 }
112112
113− self.render_diagnostics(doc, view, inner, surface, theme);
113+ self.render_diagnostics(doc, view, inner, surface, theme, debugger);
114114
115115 let area = Rect::new(
116116 view.area.x,
@@ -529,6 +529,7 @@ impl EditorView {
529529 viewport: Rect,
530530 surface: &mut Surface,
531531 theme: &Theme,
532+ debugger: &Option<helix_dap::Client>,
532533 ) {
533534 use helix_core::diagnostic::Severity;
534535 use tui::{
@@ -566,6 +567,25 @@ impl EditorView {
566567 lines.extend(text.lines);
567568 }
568569
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+
569589 let paragraph = Paragraph::new(lines).alignment(Alignment::Right);
570590 let width = 80.min(viewport.width);
571591 let height = 15.min(viewport.height);