Extension listens to its own selection channel and activates the detail tab in the context panel — fixes the chicken-and-egg where the controller only subscribes after the widget builds. Registration order in main.dart now determines sidebar icon rail order: tickets first, then decisions, files, git, pql, problems. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
52 lines
1.5 KiB
Dart
52 lines
1.5 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:clide/builtin/decisions/src/decision_detail_view.dart';
|
|
import 'package:clide/builtin/decisions/src/decisions_view.dart';
|
|
import 'package:clide/extension/extension.dart';
|
|
import 'package:clide/kernel/kernel.dart';
|
|
import 'package:clide/kernel/src/events/message_bus.dart';
|
|
import 'package:clide/widgets/widgets.dart';
|
|
|
|
class DecisionsExtension extends ClideExtension {
|
|
@override
|
|
String get id => 'builtin.decisions';
|
|
@override
|
|
String get title => 'Decisions';
|
|
@override
|
|
String get version => '0.6.0';
|
|
@override
|
|
List<String> get dependsOn => const [];
|
|
|
|
StreamSubscription<Message>? _sub;
|
|
|
|
@override
|
|
Future<void> activate(ClideExtensionContext ctx) async {
|
|
_sub = ctx.messages.subscribe(publisher: id, channel: 'selection').listen((_) {
|
|
ctx.panels.activateTab(Slots.contextPanel, 'decisions.detail');
|
|
});
|
|
}
|
|
|
|
@override
|
|
Future<void> deactivate() async => _sub?.cancel();
|
|
|
|
@override
|
|
List<ContributionPoint> get contributions => [
|
|
TabContribution(
|
|
id: 'decisions.panel',
|
|
slot: Slots.sidebar,
|
|
title: 'Decisions',
|
|
titleKey: 'tab.title',
|
|
i18nNamespace: id,
|
|
icon: PhosphorIcons.lightbulb,
|
|
build: (_) => const DecisionsView(),
|
|
),
|
|
TabContribution(
|
|
id: 'decisions.detail',
|
|
slot: Slots.contextPanel,
|
|
title: 'Decision',
|
|
icon: PhosphorIcons.lightbulb,
|
|
build: (_) => const DecisionDetailView(),
|
|
),
|
|
];
|
|
}
|