Provide a single gutter component that does breakpoint || diagnostic

This commit is contained in:
Blaž Hrastnik 2021-12-01 00:24:45 +09:00
parent d906911417
commit 84e939ef58
2 changed files with 17 additions and 2 deletions

View File

@ -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))
})
}

View File

@ -65,8 +65,7 @@ pub fn remove(&mut self, doc_id: &DocumentId) {
}
const GUTTERS: &[(Gutter, usize)] = &[
(gutter::breakpoints, 1),
(gutter::diagnostic, 1),
(gutter::diagnostics_or_breakpoints, 1),
(gutter::line_number, 5),
];