Skip to content

Commit 1780bab

Browse files
committed
wip(app): line selection
1 parent d35fabf commit 1780bab

1 file changed

Lines changed: 2 additions & 20 deletions

File tree

packages/app/src/components/prompt-input.tsx

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -162,18 +162,6 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
162162
const tabs = createMemo(() => layout.tabs(sessionKey()))
163163
const view = createMemo(() => layout.view(sessionKey()))
164164

165-
const selectionPreview = (path: string, selection: FileSelection | undefined, preview: string | undefined) => {
166-
if (preview) return preview
167-
if (!selection) return undefined
168-
const content = files.get(path)?.content?.content
169-
if (!content) return undefined
170-
const start = Math.max(1, Math.min(selection.startLine, selection.endLine))
171-
const end = Math.max(selection.startLine, selection.endLine)
172-
const lines = content.split("\n").slice(start - 1, end)
173-
if (lines.length === 0) return undefined
174-
return lines.slice(0, 2).join("\n")
175-
}
176-
177165
const recent = createMemo(() => {
178166
const all = tabs().all()
179167
const active = tabs().active()
@@ -1288,6 +1276,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
12881276
id: string
12891277
type: "text"
12901278
text: string
1279+
synthetic?: boolean
12911280
}
12921281
| {
12931282
id: string
@@ -1325,6 +1314,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
13251314
id: Identifier.ascending("part"),
13261315
type: "text",
13271316
text: commentNote(input.path, input.selection, comment),
1317+
synthetic: true,
13281318
})
13291319
}
13301320

@@ -1572,7 +1562,6 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
15721562
<div class="flex flex-nowrap items-start gap-1.5 px-3 pt-3 overflow-x-auto no-scrollbar">
15731563
<For each={prompt.context.items()}>
15741564
{(item) => {
1575-
const preview = createMemo(() => selectionPreview(item.path, item.selection, item.preview))
15761565
return (
15771566
<div
15781567
classList={{
@@ -1617,13 +1606,6 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
16171606
<Show when={item.comment}>
16181607
{(comment) => <div class="text-11-regular text-text-strong">{comment()}</div>}
16191608
</Show>
1620-
<Show when={preview()}>
1621-
{(content) => (
1622-
<pre class="text-10-regular text-text-weak font-mono whitespace-pre-wrap leading-4">
1623-
{content()}
1624-
</pre>
1625-
)}
1626-
</Show>
16271609
</div>
16281610
)
16291611
}}

0 commit comments

Comments
 (0)