opencode-vim 0.0.13 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bun.lock +9 -0
- package/package.json +3 -2
- package/src/modules/vim/index.tsx +4 -4
- package/src/prompt/root.tsx +22 -9
- package/src/prompt/ref.ts +0 -17
package/bun.lock
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@opencode-ai/plugin": "1.14.44",
|
|
16
|
+
"@types/bun": "^1.3.14",
|
|
16
17
|
},
|
|
17
18
|
},
|
|
18
19
|
},
|
|
@@ -119,6 +120,10 @@
|
|
|
119
120
|
|
|
120
121
|
"@standard-schema/spec": ["@standard-schema/spec@1.1.0", "", {}, "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w=="],
|
|
121
122
|
|
|
123
|
+
"@types/bun": ["@types/bun@1.3.14", "", { "dependencies": { "bun-types": "1.3.14" } }, "sha512-h1hFqFVcvAvD9j9K7ZW7vd82aSA+rTdznZa+5bwvCwqSB1jmmfLcbIWhOLx1/+boy/xmjgCs/OMUL8hRJSmnPw=="],
|
|
124
|
+
|
|
125
|
+
"@types/node": ["@types/node@25.7.0", "", { "dependencies": { "undici-types": "~7.21.0" } }, "sha512-z+pdZyxE+RTQE9AcboAZCb4otwcrvgHD+GlBpPgn0emDVt0ohrTMhAwlr2Wd9nZ+nihhYFxO2pThz3C5qSu2Eg=="],
|
|
126
|
+
|
|
122
127
|
"@vimee/core": ["@vimee/core@0.3.0", "", {}, "sha512-aC44fw6HhmjrbJMafAk3oUZIDpFbgNebbDsWwMIFD0WwnOUZPETgzU3HYQetmwz0e38JY3I/g8CJXRQjspgJZw=="],
|
|
123
128
|
|
|
124
129
|
"ansi-regex": ["ansi-regex@6.2.2", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="],
|
|
@@ -139,6 +144,8 @@
|
|
|
139
144
|
|
|
140
145
|
"bun-ffi-structs": ["bun-ffi-structs@0.2.2", "", { "peerDependencies": { "typescript": "^5" } }, "sha512-N/ZWtyN0piZlrXQT7TO0V+q952orYqkfhXRXM1Hcbb+R3QSiBH4vLnib187Mrs1H7pWIYECAmPeapGYDOMCl+w=="],
|
|
141
146
|
|
|
147
|
+
"bun-types": ["bun-types@1.3.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-4N0ig0fEomHt5R0KCFWjovxow98rIoRwKolrYdCcknNwMekCXRnWEUvgu5soYV8QXtVsrUD8B95MBOZGPvr6KQ=="],
|
|
148
|
+
|
|
142
149
|
"caniuse-lite": ["caniuse-lite@1.0.30001791", "", {}, "sha512-yk0l/YSrOnFZk3UROpDLQD9+kC1l4meK/wed583AXrzoarMGJcbRi2Q4RaUYbKxYAsZ8sWmaSa/DsLmdBeI1vQ=="],
|
|
143
150
|
|
|
144
151
|
"convert-source-map": ["convert-source-map@2.0.0", "", {}, "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg=="],
|
|
@@ -273,6 +280,8 @@
|
|
|
273
280
|
|
|
274
281
|
"typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
|
|
275
282
|
|
|
283
|
+
"undici-types": ["undici-types@7.21.0", "", {}, "sha512-w9IMgQrz4O0YN1LtB7K5P63vhlIOvC7opSmouCJ+ZywlPAlO9gIkJ+otk6LvGpAs2wg4econaCz3TvQ9xPoyuQ=="],
|
|
284
|
+
|
|
276
285
|
"update-browserslist-db": ["update-browserslist-db@1.2.3", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w=="],
|
|
277
286
|
|
|
278
287
|
"uuid": ["uuid@13.0.1", "", { "bin": { "uuid": "dist-node/bin/uuid" } }, "sha512-9ezox2roIft6ExBVTVqibSd5dc5/47Sw/uY6b4SjQUT2TzQ0tltNquWA46y4xPQmdZYqvnio22SgWd41M86+jw=="],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-vim",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"exports": {
|
|
5
5
|
"./tui": {
|
|
6
6
|
"import": "./tui.tsx"
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"@vimee/core": "^0.3.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@opencode-ai/plugin": "1.14.44"
|
|
17
|
+
"@opencode-ai/plugin": "1.14.44",
|
|
18
|
+
"@types/bun": "^1.3.14"
|
|
18
19
|
}
|
|
19
20
|
}
|
|
@@ -156,7 +156,7 @@ function snippetNavigationDelta(key: string) {
|
|
|
156
156
|
|
|
157
157
|
function commandNavigationKey(ctx: PromptContext, key: string): ParsedKey | undefined {
|
|
158
158
|
if (!isPromptFocused(ctx)) return navigationKey(key)
|
|
159
|
-
if (!
|
|
159
|
+
if (!isNativeCompletionToken(ctx)) return undefined
|
|
160
160
|
if (key === "j") return arrowKey("down", "\u001B[B")
|
|
161
161
|
if (key === "k") return arrowKey("up", "\u001B[A")
|
|
162
162
|
return undefined
|
|
@@ -166,12 +166,12 @@ function isPromptFocused(ctx: PromptContext) {
|
|
|
166
166
|
return ctx.prompt()?.focused === true && !!focusedInput(ctx)
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
function
|
|
169
|
+
function isNativeCompletionToken(ctx: PromptContext) {
|
|
170
170
|
const text = ctx.prompt()?.current.input ?? focusedInput(ctx)?.plainText ?? ""
|
|
171
|
-
if (!text.startsWith("/")) return false
|
|
172
171
|
const input = focusedInput(ctx)
|
|
173
172
|
const offset = Math.max(0, input?.cursorOffset ?? text.length)
|
|
174
|
-
|
|
173
|
+
const beforeCursor = text.slice(0, Math.min(offset + 1, text.length))
|
|
174
|
+
return /^\/\S*$/.test(beforeCursor) || /(?:^|\s)@\S*$/.test(beforeCursor)
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
function navigationKey(key: string): ParsedKey | undefined {
|
package/src/prompt/root.tsx
CHANGED
|
@@ -2,24 +2,37 @@
|
|
|
2
2
|
import { onCleanup } from "solid-js"
|
|
3
3
|
import type { JSX } from "@opentui/solid"
|
|
4
4
|
import { HostPrompt } from "./host"
|
|
5
|
-
import { sortModules } from "./modules"
|
|
6
|
-
import {
|
|
7
|
-
import type { PromptRootProps } from "./types"
|
|
5
|
+
import { notifyPromptRef, sortModules } from "./modules"
|
|
6
|
+
import type { PromptContext, PromptRootProps } from "./types"
|
|
8
7
|
|
|
9
8
|
export function PromptRoot(props: PromptRootProps) {
|
|
10
9
|
const modules = sortModules(props.modules)
|
|
11
10
|
const api = props.api
|
|
12
|
-
|
|
11
|
+
let current: ReturnType<PromptContext["prompt"]>
|
|
12
|
+
const ctx: PromptContext = {
|
|
13
13
|
api,
|
|
14
14
|
slot: props.slot,
|
|
15
15
|
kind: props.kind,
|
|
16
|
-
sessionID
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
get sessionID() {
|
|
17
|
+
return props.sessionID
|
|
18
|
+
},
|
|
19
|
+
get workspaceID() {
|
|
20
|
+
return props.workspaceID
|
|
21
|
+
},
|
|
22
|
+
get visible() {
|
|
23
|
+
return props.visible
|
|
24
|
+
},
|
|
25
|
+
get disabled() {
|
|
26
|
+
return props.disabled
|
|
27
|
+
},
|
|
28
|
+
prompt: () => current,
|
|
29
|
+
setPromptRef(ref) {
|
|
30
|
+
current = ref
|
|
31
|
+
notifyPromptRef(modules, ref, ctx)
|
|
32
|
+
},
|
|
20
33
|
submitHost: () => props.onSubmit?.(),
|
|
21
34
|
requestRender: () => api.renderer.requestRender(),
|
|
22
|
-
}
|
|
35
|
+
}
|
|
23
36
|
|
|
24
37
|
const cleanups = modules.flatMap((module) => {
|
|
25
38
|
const cleanup = module.setup?.(ctx)
|
package/src/prompt/ref.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { TuiPromptRef } from "@opencode-ai/plugin/tui"
|
|
2
|
-
import type { PromptContext, PromptModule } from "./types"
|
|
3
|
-
import { notifyPromptRef } from "./modules"
|
|
4
|
-
|
|
5
|
-
export function createPromptRef(modules: PromptModule[], ctx: Omit<PromptContext, "prompt" | "setPromptRef">) {
|
|
6
|
-
let current: TuiPromptRef | undefined
|
|
7
|
-
const context = {
|
|
8
|
-
...ctx,
|
|
9
|
-
prompt: () => current,
|
|
10
|
-
setPromptRef(ref: TuiPromptRef | undefined) {
|
|
11
|
-
current = ref
|
|
12
|
-
notifyPromptRef(modules, ref, context)
|
|
13
|
-
},
|
|
14
|
-
} satisfies PromptContext
|
|
15
|
-
|
|
16
|
-
return context
|
|
17
|
-
}
|