@@ -72,6 +72,40 @@ impl EditorView {
72 let area = view.area;
72 let area = view.area;
73 let theme = &editor.theme;
73 let theme = &editor.theme;
75+ // DAP: Highlight current stack frame position
76+ let stack_frame = editor.debugger.as_ref().and_then(|debugger| {
77+ if let (Some(frame), Some(thread_id)) = (debugger.active_frame, debugger.thread_id) {
81+ .and_then(|bt| bt.get(frame))
86+ if let Some(frame) = stack_frame {
87+ if doc.path().is_some()
91+ .and_then(|source| source.path.as_ref())
94+ let line = frame.line - 1; // convert to 0-indexing
95+ if line >= view.offset.row && line < view.offset.row + area.height as usize {
99+ area.y + (line - view.offset.row) as u16,
103+ theme.get("ui.highlight"),
75 let highlights =
109 let highlights =
76 Self::doc_syntax_highlights(doc, view.offset, inner.height, theme, &editor.syn_loader);
110 Self::doc_syntax_highlights(doc, view.offset, inner.height, theme, &editor.syn_loader);
77 let highlights = syntax::merge(highlights, Self::doc_diagnostics_highlights(doc, theme));
111 let highlights = syntax::merge(highlights, Self::doc_diagnostics_highlights(doc, theme));
@@ -417,38 +451,6 @@ impl EditorView {
417 .map(|range| range.cursor_line(text))
451 .map(|range| range.cursor_line(text))
418 .collect();
452 .collect();
420− // let mut stack_frame: Option<&StackFrame> = None;
421− // if let Some(path) = doc.path() {
422− // if let Some(debugger) = debugger {
423− // // if we have a frame, and the frame path matches document
424− // if let (Some(frame), Some(thread_id)) = (debugger.active_frame, debugger.thread_id)
426− // let frame = debugger
429− // .and_then(|bt| bt.get(frame)); // TODO: drop the clone..
430− // if let Some(StackFrame {
431− // source: Some(source),
435− // if source.path.as_ref() == Some(path) {
436− // stack_frame = frame;
442− // if let Some(frame) = stack_frame {
443− // if frame.line - 1 == line {
444− // surface.set_style(
445− // Rect::new(viewport.x, viewport.y + i as u16, 6, 1),
446− // helix_view::graphics::Style::default()
447− // .bg(helix_view::graphics::Color::LightYellow),
452 let mut offset = 0;
454 let mut offset = 0;
454 // avoid lots of small allocations by reusing a text buffer for each line
456 // avoid lots of small allocations by reusing a text buffer for each line
@@ -520,29 +522,6 @@ impl EditorView {
520 lines.extend(text.lines);
522 lines.extend(text.lines);
523− // let line = doc.text().char_to_line(cursor);
524− // let breakpoint = doc
526− // .and_then(|path| all_breakpoints.get(path))
527− // .and_then(|breakpoints| {
530− // .find(|breakpoint| breakpoint.line == line)
533− // if let Some(breakpoint) = breakpoint {
534− // if let Some(condition) = &breakpoint.condition {
536− // Text::styled(condition, warning.add_modifier(Modifier::UNDERLINED)).lines,
539− // if let Some(log_message) = &breakpoint.log_message {
541− // Text::styled(log_message, info.add_modifier(Modifier::UNDERLINED)).lines,
546 let paragraph = Paragraph::new(lines)
525 let paragraph = Paragraph::new(lines)
547 .alignment(Alignment::Right)
526 .alignment(Alignment::Right)
548 .wrap(Wrap { trim: true });
527 .wrap(Wrap { trim: true });