icons from extensions, settings-based tab ordering, static context tabs
Icons now declared on TabContribution via the icon field — the hardcoded switch in _BottomRail is a fallback only. All sidebar and context extensions set their Phosphor icon explicitly. PanelRegistry supports setTabOrder(slot, List<String>) — tabs render in the order specified by project.layout.sidebar.order / context.order in settings.yaml. Falls back to registration order. Priority field removed from all contributions. Context tabs are static again — persist with their last content, selection just loads new data and switches focus. No spawn/despawn. Tickets sidebar priority set to -200 (leftmost, default open). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:clide/builtin/pql/src/backlinks_view.dart';
|
||||
import 'package:clide/builtin/pql/src/pql_panel_view.dart';
|
||||
import 'package:clide/extension/extension.dart';
|
||||
import 'package:clide/kernel/kernel.dart';
|
||||
import 'package:clide/widgets/widgets.dart';
|
||||
|
||||
class PqlExtension extends ClideExtension {
|
||||
@override
|
||||
@@ -11,14 +10,10 @@ class PqlExtension extends ClideExtension {
|
||||
@override
|
||||
String get title => 'pql';
|
||||
@override
|
||||
String get version => '0.2.0';
|
||||
String get version => '0.3.0';
|
||||
@override
|
||||
List<String> get dependsOn => const [];
|
||||
|
||||
ClideExtensionContext? _ctx;
|
||||
StreamSubscription<DaemonEvent>? _editorSub;
|
||||
bool _backlinksSpawned = false;
|
||||
|
||||
@override
|
||||
List<ContributionPoint> get contributions => [
|
||||
TabContribution(
|
||||
@@ -27,46 +22,17 @@ class PqlExtension extends ClideExtension {
|
||||
title: 'pql',
|
||||
titleKey: 'tab.title',
|
||||
i18nNamespace: id,
|
||||
icon: PhosphorIcons.magnifyingGlass,
|
||||
priority: -60,
|
||||
build: (_) => const PqlPanelView(),
|
||||
),
|
||||
TabContribution(
|
||||
id: 'pql.backlinks',
|
||||
slot: Slots.contextPanel,
|
||||
title: 'Links',
|
||||
icon: PhosphorIcons.link,
|
||||
priority: -80,
|
||||
build: (_) => const BacklinksView(),
|
||||
),
|
||||
];
|
||||
|
||||
@override
|
||||
Future<void> activate(ClideExtensionContext ctx) async {
|
||||
_ctx = ctx;
|
||||
_editorSub = ctx.events.on<DaemonEvent>().listen((e) {
|
||||
if (e.subsystem != 'editor') return;
|
||||
if (e.kind == 'editor.active-changed' || e.kind == 'editor.opened') {
|
||||
_spawnBacklinks();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> deactivate() async {
|
||||
_editorSub?.cancel();
|
||||
_despawnBacklinks();
|
||||
}
|
||||
|
||||
void _spawnBacklinks() {
|
||||
final ctx = _ctx;
|
||||
if (ctx == null || _backlinksSpawned) return;
|
||||
ctx.panels.contribute(TabContribution(
|
||||
id: 'pql.backlinks',
|
||||
slot: Slots.contextPanel,
|
||||
title: 'Links',
|
||||
priority: -80,
|
||||
build: (_) => const BacklinksView(),
|
||||
));
|
||||
_backlinksSpawned = true;
|
||||
ctx.panels.activateTab(Slots.contextPanel, 'pql.backlinks');
|
||||
}
|
||||
|
||||
void _despawnBacklinks() {
|
||||
if (_backlinksSpawned) {
|
||||
_ctx?.panels.uncontribute('pql.backlinks');
|
||||
_backlinksSpawned = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user