Skip to content

Commit af8a063

Browse files
committed
Replace task copy and edit actions with a forward button to populate edit instructions
- on a task, add action 'Forward to edit instructions' (forward codicon), on click, place in instructions and focus on last used target's 'edit' prompt type - on task, remove 'copy' button - on task, remove 'edit'/'save' button - allow at most 5 tabs, once 5 is reached, hide 'add' button - hold max prompt field tabs in `apps/editor/src/constants/values.ts` - escape on task in edit mode, should cancel made edits ├── apps │ └── editor │ └── src │ └── views │ └── prompt │ └── frontend │ ├── Home │ │ └── Home.tsx │ ├── Main │ │ └── Main.tsx │ ├── Prompt.tsx │ └── hooks │ └── use-prompt │ └── use-prompt.ts └── packages └── ui └── src └── components └── editor └── prompt └── Tasks ├── Tasks.module.scss ├── Tasks.stories.tsx ├── Tasks.tsx ├── components │ └── TaskGroup.tsx ├── hooks │ └── use-auto-focus-new-task.ts └── index.ts
1 parent 8f2ff22 commit af8a063

5 files changed

Lines changed: 45 additions & 35 deletions

File tree

‎apps/editor/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "gemini-coder",
33
"displayName": "Code Web Chat",
44
"description": "AI coding with static context (CWC)",
5-
"version": "2026.9.99",
5+
"version": "2026.9.100",
66
"scripts": {
77
"build": "npx vsce package --no-dependencies",
88
"vscode:prepublish": "rimraf out && npm run compile",

‎apps/editor/src/views/prompt/frontend/Home/Home.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ type Props = {
2828
is_setup_complete: boolean
2929
is_connected: boolean
3030
on_donate_click: () => void
31+
on_forward_task: (text: string) => void
3132
bottom_spacer_height?: number
3233
}
3334

@@ -282,6 +283,7 @@ export const Home: React.FC<Props> = (props) => {
282283
on_delete={(timestamp) => {
283284
handle_delete(active_root, timestamp)
284285
}}
286+
on_forward={props.on_forward_task}
285287
translations={{
286288
placeholder: t('home.tasks.placeholder'),
287289
add_new: t('home.tasks.add-new')

‎apps/editor/src/views/prompt/frontend/Prompt.tsx‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,19 @@ export const Prompt = () => {
388388
version={version}
389389
is_setup_complete={is_setup_complete}
390390
on_donate_click={() => set_viewing_donations(true)}
391+
on_forward_task={(text) => {
392+
set_active_view('main')
393+
set_main_view_scroll_reset_key((k) => k + 1)
394+
395+
if (target == TARGET.WEB) {
396+
handle_web_prompt_type_change('edit-files')
397+
} else if (target == TARGET.API) {
398+
handle_api_prompt_type_change('edit-files')
399+
}
400+
401+
handle_instructions_change(text, 'edit-files')
402+
set_chat_input_focus_key((k) => k + 1)
403+
}}
391404
/>
392405
</div>
393406
</Layout>

‎packages/ui/src/components/editor/prompt/Tasks/Tasks.stories.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ export const Default = () => {
151151
on_add={handle_add}
152152
on_add_subtask={handle_add_subtask}
153153
on_delete={handle_delete}
154+
on_forward={(text) => console.log('Forward task:', text)}
154155
translations={{
155156
placeholder: 'Click to add text...',
156157
add_new: 'Add new...'
@@ -181,6 +182,7 @@ export const NoReorder = () => {
181182
on_add={() => {}}
182183
on_add_subtask={() => {}}
183184
on_delete={() => {}}
185+
on_forward={() => {}}
184186
translations={{
185187
placeholder: 'Click to add text...',
186188
add_new: 'Add new...'

‎packages/ui/src/components/editor/prompt/Tasks/Tasks.tsx‎

Lines changed: 27 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export namespace Tasks {
2222
on_add: () => void
2323
on_add_subtask?: (parent_task: Task) => void
2424
on_delete: (created_at: number) => void
25+
on_forward: (text: string) => void
2526
translations: {
2627
placeholder: string
2728
add_new: string
@@ -63,8 +64,8 @@ export const Tasks: React.FC<Tasks.Props> = (props) => {
6364
null
6465
)
6566
const [editing_initial_text, set_editing_initial_text] = useState<string>('')
66-
const [copied_timestamp, set_copied_timestamp] = useState<number | null>(null)
6767
const prevent_edit_ref = useRef(false)
68+
const is_canceling_ref = useRef(false)
6869

6970
const handle_set_editing = (timestamp: number | null, text?: string) => {
7071
set_editing_timestamp(timestamp)
@@ -75,7 +76,25 @@ export const Tasks: React.FC<Tasks.Props> = (props) => {
7576

7677
use_auto_focus_new_task(props.tasks, handle_set_editing)
7778

79+
const handle_cancel_edit = (task: Task) => {
80+
is_canceling_ref.current = true
81+
set_editing_timestamp(null)
82+
83+
const has_children = task.children && task.children.length > 0
84+
if (!editing_initial_text.trim() && !has_children) {
85+
props.on_delete(task.created_at)
86+
} else {
87+
const { id, ...rest } = task as any
88+
props.on_change({ ...rest, text: editing_initial_text })
89+
}
90+
91+
setTimeout(() => {
92+
is_canceling_ref.current = false
93+
}, 100)
94+
}
95+
7896
const handle_stop_editing = (task: Task) => {
97+
if (is_canceling_ref.current) return
7998
if (editing_timestamp !== task.created_at) return
8099
set_editing_timestamp(null)
81100
if (!task.text.trim()) {
@@ -189,46 +208,17 @@ export const Tasks: React.FC<Tasks.Props> = (props) => {
189208
>
190209
{params.task.text && (
191210
<IconButton
192-
codicon_icon={
193-
copied_timestamp == params.task.created_at
194-
? 'check'
195-
: 'copy'
196-
}
197-
style={
198-
copied_timestamp == params.task.created_at
199-
? { cursor: 'default' }
200-
: undefined
201-
}
211+
codicon_icon="forward"
202212
on_mouse_down={
203213
is_editing ? (e) => e.preventDefault() : undefined
204214
}
205215
on_click={(e) => {
206216
e.stopPropagation()
207-
navigator.clipboard.writeText(params.task.text)
208-
set_copied_timestamp(params.task.created_at)
209-
setTimeout(() => {
210-
set_copied_timestamp((prev) =>
211-
prev === params.task.created_at ? null : prev
212-
)
213-
}, 2000)
217+
props.on_forward(params.task.text)
214218
}}
215-
title="Copy"
219+
title="Forward to edit instructions"
216220
/>
217221
)}
218-
<IconButton
219-
codicon_icon={is_editing ? 'check' : 'edit'}
220-
on_mouse_down={
221-
is_editing ? (e) => e.preventDefault() : undefined
222-
}
223-
on_click={() => {
224-
if (is_editing) {
225-
handle_stop_editing(params.task)
226-
} else {
227-
handle_set_editing(params.task.created_at, params.task.text)
228-
}
229-
}}
230-
title={is_editing ? 'Done' : 'Edit'}
231-
/>
232222
<IconButton
233223
codicon_icon="trash"
234224
on_mouse_down={
@@ -255,7 +245,10 @@ export const Tasks: React.FC<Tasks.Props> = (props) => {
255245
handle_stop_editing(params.task)
256246
}}
257247
on_key_down={(e) => {
258-
if (e.key == 'Enter' && !e.shiftKey) {
248+
if (e.key == 'Escape') {
249+
e.preventDefault()
250+
handle_cancel_edit(params.task)
251+
} else if (e.key == 'Enter' && !e.shiftKey) {
259252
e.preventDefault()
260253
}
261254
}}

0 commit comments

Comments
 (0)