show breakpoint condition in diagnostics

pull/574/head
Dmitry Sharshakov 3 years ago
parent 53ee57f84a
commit b78f70e602
No known key found for this signature in database
GPG Key ID: 471FD32E15FD8473

@ -110,7 +110,7 @@ impl EditorView {
} }
} }
self.render_diagnostics(doc, view, inner, surface, theme); self.render_diagnostics(doc, view, inner, surface, theme, debugger);
let area = Rect::new( let area = Rect::new(
view.area.x, view.area.x,
@ -529,6 +529,7 @@ impl EditorView {
viewport: Rect, viewport: Rect,
surface: &mut Surface, surface: &mut Surface,
theme: &Theme, theme: &Theme,
debugger: &Option<helix_dap::Client>,
) { ) {
use helix_core::diagnostic::Severity; use helix_core::diagnostic::Severity;
use tui::{ use tui::{
@ -566,6 +567,25 @@ impl EditorView {
lines.extend(text.lines); lines.extend(text.lines);
} }
if let Some(debugger) = debugger {
if let Some(path) = doc.path() {
if let Some(breakpoints) = debugger.breakpoints.get(path) {
let line = doc.text().char_to_line(cursor);
if let Some(breakpoint) = breakpoints
.iter()
.find(|breakpoint| breakpoint.line - 1 == line)
{
if let Some(condition) = &breakpoint.condition {
lines.extend(
Text::styled(condition, info.add_modifier(Modifier::UNDERLINED))
.lines,
);
}
}
}
}
}
let paragraph = Paragraph::new(lines).alignment(Alignment::Right); let paragraph = Paragraph::new(lines).alignment(Alignment::Right);
let width = 80.min(viewport.width); let width = 80.min(viewport.width);
let height = 15.min(viewport.height); let height = 15.min(viewport.height);

Loading…
Cancel
Save