30 lines
870 B
JavaScript
30 lines
870 B
JavaScript
import { Plugin } from "@opencode/plugin/tui"
|
||
|
||
export default Plugin.define({
|
||
id: "oc-session-all",
|
||
setup(context) {
|
||
console.log("[oc-session-all] v2 Plugin loaded!")
|
||
context.ui.toast.show({
|
||
message: "[oc-session-all] v2 loaded! Testing keymap...",
|
||
variant: "success",
|
||
duration: 3000,
|
||
})
|
||
|
||
// 只注册 command,不注册 binding(方法名是 registerLayer 不是 layer)
|
||
context.keymap.registerLayer({
|
||
commands: [
|
||
{
|
||
title: "All Sessions",
|
||
value: "sessions.all",
|
||
description: "Browse and switch to any session across all projects",
|
||
category: "Session Picker",
|
||
slash: { name: "sessions-all" },
|
||
onSelect: () => {
|
||
context.ui.toast.show({ message: "sessions-all triggered!", variant: "info" });
|
||
},
|
||
},
|
||
],
|
||
})
|
||
},
|
||
})
|