diff options
| author | Adam <[email protected]> | 2026-01-21 05:27:52 -0600 |
|---|---|---|
| committer | Adam <[email protected]> | 2026-01-22 22:12:12 -0600 |
| commit | 0ce0cacb282c47943348a2af21ea00e721bcb9d9 (patch) | |
| tree | e1c17ec3dc03ce1fd86f348059a6401e700eb60d /packages/app/src/context | |
| parent | 640d1f1ecc7a2b46fb2bafed760c7348c70579a8 (diff) | |
| download | opencode-0ce0cacb282c47943348a2af21ea00e721bcb9d9.tar.gz opencode-0ce0cacb282c47943348a2af21ea00e721bcb9d9.zip | |
wip(app): line selection
Diffstat (limited to 'packages/app/src/context')
| -rw-r--r-- | packages/app/src/context/prompt.tsx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/app/src/context/prompt.tsx b/packages/app/src/context/prompt.tsx index 993d7e7a8..a76d9d5f1 100644 --- a/packages/app/src/context/prompt.tsx +++ b/packages/app/src/context/prompt.tsx @@ -4,6 +4,7 @@ import { batch, createMemo, createRoot, onCleanup } from "solid-js" import { useParams } from "@solidjs/router" import type { FileSelection } from "@/context/file" import { Persist, persisted } from "@/utils/persist" +import { checksum } from "@opencode-ai/util/encode" interface PartBase { content: string @@ -41,6 +42,8 @@ export type FileContextItem = { type: "file" path: string selection?: FileSelection + comment?: string + preview?: string } export type ContextItem = FileContextItem @@ -135,7 +138,11 @@ function createPromptSession(dir: string, id: string | undefined) { if (item.type !== "file") return item.type const start = item.selection?.startLine const end = item.selection?.endLine - return `${item.type}:${item.path}:${start}:${end}` + const key = `${item.type}:${item.path}:${start}:${end}` + const comment = item.comment?.trim() + if (!comment) return key + const digest = checksum(comment) ?? comment + return `${key}:c=${digest.slice(0, 8)}` } return { |
