diff options
| author | opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> | 2026-04-27 19:38:33 +0000 |
|---|---|---|
| committer | opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> | 2026-04-27 19:38:33 +0000 |
| commit | 7a1c8465f5f96b2f530da72839788b6097173063 (patch) | |
| tree | 924138df5eb3592cd71fc65112f08c073c2015e2 | |
| parent | 5290e9ca7ee18e18363ae31cb92a4b0d550b5c8d (diff) | |
| download | opencode-7a1c8465f5f96b2f530da72839788b6097173063.tar.gz opencode-7a1c8465f5f96b2f530da72839788b6097173063.zip | |
chore: generate
| -rw-r--r-- | packages/opencode/src/cli/cmd/tui/context/editor-zed.ts | 13 | ||||
| -rw-r--r-- | packages/opencode/test/cli/tui/editor-context.test.ts | 11 |
2 files changed, 11 insertions, 13 deletions
diff --git a/packages/opencode/src/cli/cmd/tui/context/editor-zed.ts b/packages/opencode/src/cli/cmd/tui/context/editor-zed.ts index bae88f28d..9a776f250 100644 --- a/packages/opencode/src/cli/cmd/tui/context/editor-zed.ts +++ b/packages/opencode/src/cli/cmd/tui/context/editor-zed.ts @@ -38,7 +38,9 @@ export async function resolveZedSelection(dbPath: string, cwd = process.cwd()): const text = contents.type === "contents" && contents.contents != null ? contents.contents - : await Bun.file(row.buffer_path).text().catch(() => undefined) + : await Bun.file(row.buffer_path) + .text() + .catch(() => undefined) if (text == null) return { type: "unavailable" } const startOffset = Math.min(row.selection_start, row.selection_end) @@ -79,11 +81,10 @@ function queryZedActiveEditor(dbPath: string, cwd: string) { ) .all() - const rows = raw - .flatMap((row) => { - const parsed = ZedEditorRowSchema.safeParse(row) - return parsed.success ? [parsed.data] : [] - }) + const rows = raw.flatMap((row) => { + const parsed = ZedEditorRowSchema.safeParse(row) + return parsed.success ? [parsed.data] : [] + }) if (raw.length > 0 && rows.length === 0) return { type: "unavailable" as const } diff --git a/packages/opencode/test/cli/tui/editor-context.test.ts b/packages/opencode/test/cli/tui/editor-context.test.ts index 60a1d5834..770e850d2 100644 --- a/packages/opencode/test/cli/tui/editor-context.test.ts +++ b/packages/opencode/test/cli/tui/editor-context.test.ts @@ -25,13 +25,10 @@ async function writeZedFixture(dir: string, options: ZedFixtureOptions = {}) { db.run("insert into panes values (1, 1, 1)") db.run("insert into items values (1, 1, 1, 1, 'Editor')") db.run("insert into editors values (1, 1, ?, ?)", [filePath, "one\ntwo\nthree"]) - db.run( - "insert into editor_selections values (1, 1, ?, ?)", - [ - options.selectionStart === undefined ? 4 : options.selectionStart, - options.selectionEnd === undefined ? 7 : options.selectionEnd, - ], - ) + db.run("insert into editor_selections values (1, 1, ?, ?)", [ + options.selectionStart === undefined ? 4 : options.selectionStart, + options.selectionEnd === undefined ? 7 : options.selectionEnd, + ]) db.close() return { dbPath, filePath } |
