Files
clide/lib/builtin/diff/src/extension.dart
T
jpmschweitzerandClaude Opus 4.8 6d0ebab721 chore: adopt Dart 3.9 toolchain — honest floor + tall-style reformat (T-353)
Raise the declared minimums in pubspec.yaml to what our deps already
require: Flutter >=3.35.0 / Dart >=3.9.0 (was 3.19.0 / 3.5.0). alchemist
0.12 needs Flutter 3.32; Dart 3.9 first ships in Flutter 3.35, so 3.35 is
the binding floor. Pin the exact build toolchain in .fvmrc (Flutter
3.44.1).

Moving to the Dart 3.9 language level switches `dart format` to the new
"tall" style and enables two new lints. This commit is the resulting
mechanical churn, isolated from any behaviour change:
  - whole-tree `dart format` reformat (tall style)
  - `dart fix` for unnecessary_underscores + use_null_aware_elements

No runtime behaviour change; `make test` green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-11 12:11:53 +02:00

60 lines
1.9 KiB
Dart

import 'dart:async';
import 'package:clide/builtin/diff/src/diff_controller.dart';
import 'package:clide/builtin/diff/src/diff_view.dart';
import 'package:clide/extension/extension.dart';
import 'package:clide/kernel/kernel.dart';
class DiffExtension extends ClideExtension {
@override
String get id => 'builtin.diff';
@override
String get title => 'Diff';
@override
String get version => '0.2.0';
@override
List<String> get dependsOn => const [];
/// App-scoped controller retained across tab reveal/remount so a
/// `ui open diff <path>` focus survives the view being (re)built (T-233).
/// Built in [activate] where the kernel ipc/events are in scope; the view
/// renders it but does not own it.
DiffController? _controller;
StreamSubscription<Message>? _sub;
@override
List<ContributionPoint> get contributions => [
TabContribution(
id: 'diff.view',
slot: Slots.workspace,
title: 'Diff',
titleKey: 'tab.title',
i18nNamespace: id,
priority: -70,
build: (_) => DiffView(controller: _controller),
),
];
@override
Future<void> activate(ClideExtensionContext ctx) async {
_controller = DiffController(ipc: ctx.ipc, events: ctx.events)..load();
// `clide ui open diff <path>` publishes a 'selection' here (T-233, the
// diff-panel arm of D-6 parity). Reveal the diff tab and focus the file —
// the same reveal mechanism the ReaderNav viewers use for their tabs.
_sub = ctx.messages.subscribe(publisher: id, channel: 'selection').listen((msg) {
final path = msg.data['path'];
if (path is! String || path.isEmpty) return;
ctx.panels.activateTab(Slots.workspace, 'diff.view');
_controller?.focus(path);
});
}
@override
Future<void> deactivate() async {
await _sub?.cancel();
_sub = null;
_controller?.dispose();
_controller = null;
}
}