@@ -1536,6 +1536,86 @@ pub fn goto_reference(cx: &mut Context) {
1539+fn goto_pos(editor: &mut Editor, pos: usize) {
1542+ let (view, doc) = editor.current();
1544+ doc.set_selection(view.id, Selection::point(pos));
1545+ align_view(doc, view, Align::Center);
1548+pub fn goto_first_diag(cx: &mut Context) {
1549+ let editor = &mut cx.editor;
1550+ let (view, doc) = editor.current();
1552+ let cursor_pos = doc.selection(view.id).cursor();
1553+ let diag = if let Some(diag) = doc.diagnostics().first() {
1559+ goto_pos(editor, diag);
1562+pub fn goto_last_diag(cx: &mut Context) {
1563+ let editor = &mut cx.editor;
1564+ let (view, doc) = editor.current();
1566+ let cursor_pos = doc.selection(view.id).cursor();
1567+ let diag = if let Some(diag) = doc.diagnostics().last() {
1573+ goto_pos(editor, diag);
1576+pub fn goto_next_diag(cx: &mut Context) {
1577+ let editor = &mut cx.editor;
1578+ let (view, doc) = editor.current();
1580+ let cursor_pos = doc.selection(view.id).cursor();
1581+ let diag = if let Some(diag) = doc
1584+ .map(|diag| diag.range.start)
1585+ .find(|&pos| pos > cursor_pos)
1588+ } else if let Some(diag) = doc.diagnostics().first() {
1594+ goto_pos(editor, diag);
1597+pub fn goto_prev_diag(cx: &mut Context) {
1598+ let editor = &mut cx.editor;
1599+ let (view, doc) = editor.current();
1601+ let cursor_pos = doc.selection(view.id).cursor();
1602+ let diag = if let Some(diag) = doc
1606+ .map(|diag| diag.range.start)
1607+ .find(|&pos| pos < cursor_pos)
1610+ } else if let Some(diag) = doc.diagnostics().last() {
1616+ goto_pos(editor, diag);
1539pub fn signature_help(cx: &mut Context) {
1619pub fn signature_help(cx: &mut Context) {
1540 let (view, doc) = cx.current();
1620 let (view, doc) = cx.current();
@@ -2433,3 +2513,35 @@ pub fn view_mode(cx: &mut Context) {
2517+pub fn left_bracket_mode(cx: &mut Context) {
2518+ cx.on_next_key(move |cx, event| {
2520+ code: KeyCode::Char(ch),
2525+ 'd' => goto_prev_diag(cx),
2526+ 'D' => goto_first_diag(cx),
2533+pub fn right_bracket_mode(cx: &mut Context) {
2534+ cx.on_next_key(move |cx, event| {
2536+ code: KeyCode::Char(ch),
2541+ 'd' => goto_next_diag(cx),
2542+ 'D' => goto_last_diag(cx),