on master help sign in
Provide a single gutter component that does breakpoint || diagnostic
84e939eBlaž Hrastnik
helix-view/src/gutter.rs+16
@@ -155,3 +155,19 @@ pub fn breakpoints<'doc>(
155 Some(style)
155 Some(style)
156 })
156 })
157}
157}
158+
159+pub fn diagnostics_or_breakpoints<'doc>(
160+ editor: &'doc Editor,
161+ doc: &'doc Document,
162+ view: &View,
163+ theme: &Theme,
164+ is_focused: bool,
165+ width: usize,
166+) -> GutterFn<'doc> {
167+ let diagnostics = diagnostic(editor, doc, view, theme, is_focused, width);
168+ let breakpoints = breakpoints(editor, doc, view, theme, is_focused, width);
169+
170+ Box::new(move |line, selected, out| {
171+ breakpoints(line, selected, out).or_else(|| diagnostics(line, selected, out))
172+ })
173+}
helix-view/src/view.rs+1−2
@@ -65,8 +65,7 @@ impl JumpList {
65}
65}
66
66
67const GUTTERS: &[(Gutter, usize)] = &[
67const GUTTERS: &[(Gutter, usize)] = &[
68− (gutter::breakpoints, 1),
68+ (gutter::diagnostics_or_breakpoints, 1),
69− (gutter::diagnostic, 1),
70 (gutter::line_number, 5),
69 (gutter::line_number, 5),
71];
70];
72
71