@@ -15,7 +15,6 @@ use helix_core::{
15 unicode::width::UnicodeWidthStr,
15 unicode::width::UnicodeWidthStr,
16 LineEnding, Position, Range, Selection,
16 LineEnding, Position, Range, Selection,
18−use helix_dap::{Breakpoint, SourceBreakpoint, StackFrame};
19use helix_view::{
18use helix_view::{
20 document::{Mode, SCRATCH_BUFFER_NAME},
19 document::{Mode, SCRATCH_BUFFER_NAME},
21 graphics::{Color, CursorKind, Modifier, Rect, Style},
20 graphics::{Color, CursorKind, Modifier, Rect, Style},
@@ -24,7 +23,7 @@ use helix_view::{
24 keyboard::{KeyCode, KeyModifiers},
23 keyboard::{KeyCode, KeyModifiers},
25 Document, Editor, Theme, View,
24 Document, Editor, Theme, View,
27−use std::{borrow::Cow, collections::HashMap, path::PathBuf};
26+use std::borrow::Cow;
29use crossterm::event::{Event, MouseButton, MouseEvent, MouseEventKind};
28use crossterm::event::{Event, MouseButton, MouseEvent, MouseEventKind};
30use tui::buffer::Buffer as Surface;
29use tui::buffer::Buffer as Surface;
@@ -74,7 +73,6 @@ impl EditorView {
74 let inner = view.inner_area();
73 let inner = view.inner_area();
75 let area = view.area;
74 let area = view.area;
76 let theme = &editor.theme;
75 let theme = &editor.theme;
77− let all_breakpoints = HashMap::new();
79 let highlights = Self::doc_syntax_highlights(doc, view.offset, inner.height, theme, loader);
77 let highlights = Self::doc_syntax_highlights(doc, view.offset, inner.height, theme, loader);
80 let highlights = syntax::merge(highlights, Self::doc_diagnostics_highlights(doc, theme));
78 let highlights = syntax::merge(highlights, Self::doc_diagnostics_highlights(doc, theme));
@@ -107,7 +105,7 @@ impl EditorView {
110− self.render_diagnostics(doc, view, inner, surface, theme, &all_breakpoints);
108+ self.render_diagnostics(doc, view, inner, surface, theme);
112 let statusline_area = view
110 let statusline_area = view
@@ -436,39 +434,21 @@ impl EditorView {
436 let error = theme.get("error");
434 let error = theme.get("error");
437 let info = theme.get("info");
435 let info = theme.get("info");
439− let all_breakpoints = &editor.breakpoints;
441− // TODO: debugger breakpoints should keep editor level breakpoints in sync
443 let breakpoints = doc
437 let breakpoints = doc
445− .and_then(|path| all_breakpoints.get(path))
439+ .and_then(|path| editor.breakpoints.get(path))
446 .unwrap();
440 .unwrap();
448 Box::new(move |line: usize, _selected: bool, out: &mut String| {
442 Box::new(move |line: usize, _selected: bool, out: &mut String| {
449− // TODO: debugger should translate received breakpoints to 0-indexing
450− let breakpoint = breakpoints.iter().find(|breakpoint| {
443+ let breakpoint = breakpoints
452− // if breakpoint.source == doc.path() {
453− // match (breakpoint.line, breakpoint.end_line) {
445+ .find(|breakpoint| breakpoint.line == line);
454− // #[allow(clippy::int_plus_one)]
455− // (Some(l), Some(el)) => l - 1 <= line && line <= el - 1,
456− // (Some(l), None) => l - 1 == line,
464 let breakpoint = match breakpoint {
447 let breakpoint = match breakpoint {
465 Some(b) => b,
448 Some(b) => b,
466 None => return None,
449 None => return None,
469− // let verified = breakpoint.verified;
470− let verified = false;
472 let mut style =
452 let mut style =
473 if breakpoint.condition.is_some() && breakpoint.log_message.is_some() {
453 if breakpoint.condition.is_some() && breakpoint.log_message.is_some() {
474 error.add_modifier(Modifier::UNDERLINED)
454 error.add_modifier(Modifier::UNDERLINED)
@@ -480,7 +460,7 @@ impl EditorView {
483− if !verified {
463+ if !breakpoint.verified {
484 // Faded colors
464 // Faded colors
485 style = if let Some(Color::Rgb(r, g, b)) = style.fg {
465 style = if let Some(Color::Rgb(r, g, b)) = style.fg {
486 style.fg(Color::Rgb(
466 style.fg(Color::Rgb(
@@ -495,7 +475,7 @@ impl EditorView {
496 // TODO: also handle breakpoints only present in the user struct
476 // TODO: also handle breakpoints only present in the user struct
497 use std::fmt::Write;
477 use std::fmt::Write;
498− let sym = if verified { "▲" } else { "⊚" };
478+ let sym = if breakpoint.verified { "▲" } else { "⊚" };
499 write!(out, "{}", sym).unwrap();
479 write!(out, "{}", sym).unwrap();
500 Some(style)
480 Some(style)
@@ -567,7 +547,6 @@ impl EditorView {
567 viewport: Rect,
547 viewport: Rect,
568 surface: &mut Surface,
548 surface: &mut Surface,
569 theme: &Theme,
549 theme: &Theme,
570− all_breakpoints: &HashMap<PathBuf, Vec<SourceBreakpoint>>,
572 use helix_core::diagnostic::Severity;
551 use helix_core::diagnostic::Severity;
573 use tui::{
552 use tui::{
@@ -605,28 +584,28 @@ impl EditorView {
605 lines.extend(text.lines);
584 lines.extend(text.lines);
608− if let Some(path) = doc.path() {
609− let line = doc.text().char_to_line(cursor);
587+ // let line = doc.text().char_to_line(cursor);
588+ // let breakpoint = doc
610− if let Some(breakpoints) = all_breakpoints.get(path) {
590+ // .and_then(|path| all_breakpoints.get(path))
591+ // .and_then(|breakpoints| {
611− if let Some(breakpoint) = breakpoints
592+ // breakpoints
612− .iter()
593+ // .iter()
613− .find(|breakpoint| breakpoint.line - 1 == line)
594+ // .find(|breakpoint| breakpoint.line == line)
597+ // if let Some(breakpoint) = breakpoint {
615− if let Some(condition) = &breakpoint.condition {
598+ // if let Some(condition) = &breakpoint.condition {
616− lines.extend(
599+ // lines.extend(
617− Text::styled(condition, warning.add_modifier(Modifier::UNDERLINED))
600+ // Text::styled(condition, warning.add_modifier(Modifier::UNDERLINED)).lines,
621− if let Some(log_message) = &breakpoint.log_message {
603+ // if let Some(log_message) = &breakpoint.log_message {
622− lines.extend(
604+ // lines.extend(
623− Text::styled(log_message, info.add_modifier(Modifier::UNDERLINED))
605+ // Text::styled(log_message, info.add_modifier(Modifier::UNDERLINED)).lines,
631 let paragraph = Paragraph::new(lines)
610 let paragraph = Paragraph::new(lines)
632 .alignment(Alignment::Right)
611 .alignment(Alignment::Right)