diff options
| author | Felix Sanchez <[email protected]> | 2026-01-13 18:03:45 -0600 |
|---|---|---|
| committer | Frank <[email protected]> | 2026-01-13 19:51:02 -0500 |
| commit | e2ac588c8428a39b56a0f42ec723bc8143b7c0bd (patch) | |
| tree | f45d60163abd115fae36012dbae72b99efc53165 | |
| parent | 8917dfdf5e30d4b920495ed844efe02cda635dcf (diff) | |
| download | opencode-e2ac588c8428a39b56a0f42ec723bc8143b7c0bd.tar.gz opencode-e2ac588c8428a39b56a0f42ec723bc8143b7c0bd.zip | |
fix: deduplicate file refs in sent prompts (#8303)
| -rw-r--r-- | packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx index 4f8f979d5..5b5358ef0 100644 --- a/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx @@ -159,6 +159,28 @@ export function Autocomplete(props: { }) props.setPrompt((draft) => { + if (part.type === "file") { + const existingIndex = draft.parts.findIndex( + (p) => p.type === "file" && "url" in p && p.url === part.url, + ) + if (existingIndex !== -1) { + const existing = draft.parts[existingIndex] + if ( + part.source?.text && + existing && + "source" in existing && + existing.source && + "text" in existing.source && + existing.source.text + ) { + existing.source.text.start = extmarkStart + existing.source.text.end = extmarkEnd + existing.source.text.value = virtualText + } + return + } + } + if (part.type === "file" && part.source?.text) { part.source.text.start = extmarkStart part.source.text.end = extmarkEnd |
