更新tui.js
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
node_modules/
|
||||
*.js
|
||||
!tui-plugins/oc-session-all-debug.js
|
||||
!tui-plugins/oc-session-all.js
|
||||
src/
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
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" });
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user