Provide a single gutter component that does breakpoint || diagnostic

imgbot
Blaž Hrastnik 3 years ago
parent d906911417
commit 84e939ef58

@ -155,3 +155,19 @@ pub fn breakpoints<'doc>(
Some(style)
})
}
pub fn diagnostics_or_breakpoints<'doc>(
editor: &'doc Editor,
doc: &'doc Document,
view: &View,
theme: &Theme,
is_focused: bool,
width: usize,
) -> GutterFn<'doc> {
let diagnostics = diagnostic(editor, doc, view, theme, is_focused, width);
let breakpoints = breakpoints(editor, doc, view, theme, is_focused, width);
Box::new(move |line, selected, out| {
breakpoints(line, selected, out).or_else(|| diagnostics(line, selected, out))
})
}

@ -65,8 +65,7 @@ impl JumpList {
}
const GUTTERS: &[(Gutter, usize)] = &[
(gutter::breakpoints, 1),
(gutter::diagnostic, 1),
(gutter::diagnostics_or_breakpoints, 1),
(gutter::line_number, 5),
];

Loading…
Cancel
Save