Skip to content

Commit 2ddc9e8

Browse files
committed
Add preparing progress indicator to apply response command
- once applying from clipboard, the progress modal in Prompt View appears with noticable delay, should immediately - when there is an ongoing response in preview, 'show progress' modal for other coming-in responses should not be shown (showing 'switch' modal, even with slight delay is alright) - the first 'show progress' modal should show 'Preparing...' subtitle ├── apps │ └── editor │ └── src │ ├── commands │ │ └── apply-response-command │ │ ├── apply-response-command.ts │ │ ├── response-processor │ │ │ └── response-processor.ts │ │ └── utils │ │ └── response-parser │ │ └── response-parser.ts │ ├── context │ │ ├── helpers │ │ │ └── get-all-workspace-files.ts │ │ └── providers │ │ └── workspace │ │ └── workspace-provider.ts │ ├── features │ │ └── checkpoints │ │ └── actions │ │ └── create-checkpoint.ts │ ├── i18n │ │ └── translations │ │ └── common.ts │ └── views │ └── prompt │ ├── backend │ │ └── prompt-view-provider.ts │ ├── frontend │ │ ├── Prompt.tsx │ │ ├── components │ │ │ └── Layout │ │ │ └── Footer │ │ │ └── Footer.tsx │ │ └── hooks │ │ └── use-modal-manager.ts │ └── types │ └── messages.ts └── packages └── ui └── src └── components └── editor └── prompt-view └── modals ├── Modal │ └── Modal.tsx └── ProgressModal ├── ProgressModal.module.scss └── ProgressModal.tsx
1 parent 49c4275 commit 2ddc9e8

2 files changed

Lines changed: 48 additions & 1 deletion

File tree

‎apps/editor/src/commands/apply-response-command/apply-response-command.ts‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ export const apply_response_command = (params: {
9999

100100
const resolve_fn = get_response_preview_promise_resolve()
101101

102+
if (!resolve_fn) {
103+
params.prompt_view_provider.send_message({
104+
command: 'SHOW_PROGRESS',
105+
title: t('common.progress.response-preview'),
106+
subtitle: t('common.progress.preparing')
107+
})
108+
}
109+
102110
const is_single_root_folder_workspace =
103111
(vscode.workspace.workspaceFolders?.length ?? 0) <= 1
104112

@@ -149,6 +157,7 @@ export const apply_response_command = (params: {
149157
) as any
150158

151159
if (commit_message_item) {
160+
params.prompt_view_provider.send_message({ command: 'HIDE_PROGRESS' })
152161
await vscode.commands.executeCommand(
153162
'codeWebChat.internal.generateCommitMessageWithProvidedTextAndCommit',
154163
commit_message_item.message
@@ -165,6 +174,7 @@ export const apply_response_command = (params: {
165174
)
166175

167176
if (patch_repair_items.length > 0) {
177+
params.prompt_view_provider.send_message({ command: 'HIDE_PROGRESS' })
168178
if (!resolve_fn) {
169179
return false
170180
}
@@ -182,6 +192,7 @@ export const apply_response_command = (params: {
182192
)
183193

184194
if (is_code_at_cursor) {
195+
params.prompt_view_provider.send_message({ command: 'HIDE_PROGRESS' })
185196
const item = response_items.find(
186197
(i) => i.type === 'code-at-cursor'
187198
) as any
@@ -213,6 +224,9 @@ export const apply_response_command = (params: {
213224
patch_repair_items.length === 0
214225
) {
215226
if ((args as any)?.is_from_agentic_cli) {
227+
params.prompt_view_provider.send_message({
228+
command: 'HIDE_PROGRESS'
229+
})
216230
vscode.window.showWarningMessage(
217231
t('command.apply-response-command.error.no-valid-response')
218232
)
@@ -248,16 +262,27 @@ export const apply_response_command = (params: {
248262
}
249263

250264
if (params.prompt_view_provider.preview_switch_choice_resolver) {
265+
params.prompt_view_provider.send_message({
266+
command: 'HIDE_PROGRESS'
267+
})
251268
return
252269
}
253270

254271
const choice = await new Promise<'Switch' | undefined>((resolve) => {
272+
params.prompt_view_provider.send_message({
273+
command: 'HIDE_PROGRESS'
274+
})
255275
params.prompt_view_provider.preview_switch_choice_resolver = resolve
256276
params.prompt_view_provider.show_preview_ongoing_modal()
257277
})
258278
params.prompt_view_provider.preview_switch_choice_resolver = undefined
259279

260280
if (choice === 'Switch') {
281+
params.prompt_view_provider.send_message({
282+
command: 'SHOW_PROGRESS',
283+
title: t('common.progress.response-preview'),
284+
subtitle: t('common.progress.preparing')
285+
})
261286
args = { ...args, created_at: created_at_for_switch }
262287
resolve_fn({ accepted_files: [] })
263288
if (ongoing_preview_cleanup_promise) {
@@ -272,6 +297,9 @@ export const apply_response_command = (params: {
272297
}
273298

274299
in_progress = true
300+
} catch (err) {
301+
params.prompt_view_provider.send_message({ command: 'HIDE_PROGRESS' })
302+
throw err
275303
} finally {
276304
release_mutex()
277305
}

‎apps/editor/src/i18n/translations/common.ts‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,24 @@ export const translations = {
539539
hu: 'Válasz előnézete',
540540
bg: 'Преглед на отговора'
541541
},
542+
'common.progress.preparing': {
543+
en: 'Preparing...',
544+
pl: 'Przygotowywanie...',
545+
'zh-cn': '准备中...',
546+
ja: '準備中...',
547+
'zh-tw': '準備中...',
548+
de: 'Vorbereitung...',
549+
es: 'Preparando...',
550+
fr: 'Préparation...',
551+
'pt-br': 'Preparando...',
552+
ru: 'Подготовка...',
553+
ko: '준비 중...',
554+
it: 'Preparazione...',
555+
tr: 'Hazırlanıyor...',
556+
cs: 'Příprava...',
557+
hu: 'Előkészítés...',
558+
bg: 'Подготовка...'
559+
},
542560
'common.separator.recently-used': {
543561
en: 'recently used',
544562
pl: 'ostatnio używane',
@@ -1667,7 +1685,8 @@ export const translations = {
16671685
de: 'Der Arbeitsbereich ist nicht vertrauenswürdig. Diese Funktion ist deaktiviert.',
16681686
es: 'El espacio de trabajo no es de confianza. Esta función está deshabilitada.',
16691687
fr: "L'espace de travail n'est pas approuvé. Cette fonctionnalité est désactivée.",
1670-
'pt-br': 'O espaço de trabalho não é confiável. Este recurso está desativado.',
1688+
'pt-br':
1689+
'O espaço de trabalho não é confiável. Este recurso está desativado.',
16711690
ru: 'Рабочая область не является доверенной. Эта функция отключена.',
16721691
ko: '작업 공간을 신뢰할 수 없습니다. 이 기능은 비활성화되었습니다.',
16731692
it: "L'area di lavoro non è attendibile. Questa funzionalità è disabilitata.",

0 commit comments

Comments
 (0)