open a file in the diff panel via clide ui open diff

Adds diff as a fourth ui.open target. The diff extension now retains an
app-scoped DiffController and subscribes to its builtin.diff/selection
channel: a selection reveals the diff tab and focuses the file, which
the view scrolls into view and highlights. Retaining the controller in
the extension (not the view) lets a focus survive the tab being
revealed/remounted, mirroring the ReaderNav viewers.

Closes T-233.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-06 10:50:12 +02:00
co-authored by Claude Opus 4.8
parent ba230d4139
commit 870b773381
11 changed files with 303 additions and 13 deletions
+4 -1
View File
@@ -26,11 +26,14 @@ typedef MessagePublisher = void Function(String publisher, String channel, Map<S
/// The readers `ui.open` can target → (bus publisher id, payload key the
/// reader reads its entry from). Matches each reader's `ReaderNav` dataKey
/// (tickets/decisions key on `id`; markdown on `path`).
/// (tickets/decisions key on `id`; markdown on `path`). `diff` is not a
/// ReaderNav reader — it keys on `path` and its extension subscribes to the
/// same `selection` channel to reveal its tab + focus the file (T-233).
const Map<String, ({String publisher, String dataKey})> _readers = {
'tickets': (publisher: 'builtin.tickets', dataKey: 'id'),
'decisions': (publisher: 'builtin.decisions', dataKey: 'id'),
'markdown': (publisher: 'builtin.markdown', dataKey: 'path'),
'diff': (publisher: 'builtin.diff', dataKey: 'path'),
};
/// Severities the toast verb accepts — mirrors `ToastSeverity` (kept as a