mirror of
https://github.com/earendil-works/pi.git
synced 2026-06-18 15:54:04 +08:00
abb1775ff7
* Add widget placement for extension widgets * Remove changelog entry for widget placement * Keep no-op widget signature * Move widget render before attach
18 lines
526 B
TypeScript
18 lines
526 B
TypeScript
import type { ExtensionAPI, ExtensionContext } from "@mariozechner/pi-coding-agent";
|
|
|
|
const applyWidgets = (ctx: ExtensionContext) => {
|
|
if (!ctx.hasUI) return;
|
|
ctx.ui.setWidget("widget-above", ["Above editor widget"]);
|
|
ctx.ui.setWidget("widget-below", ["Below editor widget"], { placement: "belowEditor" });
|
|
};
|
|
|
|
export default function widgetPlacementExtension(pi: ExtensionAPI) {
|
|
pi.on("session_start", (_event, ctx) => {
|
|
applyWidgets(ctx);
|
|
});
|
|
|
|
pi.on("session_switch", (_event, ctx) => {
|
|
applyWidgets(ctx);
|
|
});
|
|
}
|