Skip to content

Commit 55d7719

Browse files
committed
Unify context update success notifications across commands
- instead of 'added x files to context' use a common translation: 'Context has been updated.' - [Fragment] should be used instead of command.apply-response.relevant-files.success ├── apps │ └── editor │ └── src │ ├── commands │ │ ├── apply-response-command │ │ │ └── response-processor.ts │ │ ├── search-files-commands.ts │ │ ├── select-clipboard-paths-command.ts │ │ └── select-unstaged-files-command.ts │ └── i18n │ └── translations │ ├── commands │ │ ├── apply-response.ts │ │ ├── search-files.ts │ │ ├── select-clipboard-paths.ts │ │ └── select-unstaged-files.ts │ └── common.ts └── packages └── shared └── src └── constants └── dictionary.ts
1 parent 67ef470 commit 55d7719

8 files changed

Lines changed: 22 additions & 70 deletions

File tree

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,7 @@ export const process_response = async (params: {
197197
shared_context_state.switch_context_state(true)
198198
}
199199

200-
vscode.window.showInformationMessage(
201-
t('command.apply-response.relevant-files.success')
202-
)
200+
vscode.window.showInformationMessage(t('common.success.context-updated'))
203201
}
204202

205203
return null

‎apps/editor/src/commands/search-files-commands.ts‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,7 @@ export const search_files_commands = (
102102
data: { paths: selected_paths, folder: folder_path }
103103
})
104104

105-
const newly_selected_count = selected_paths.filter(
106-
(p) => !currently_checked.includes(p)
107-
).length
108-
109-
if (newly_selected_count > 0) {
110-
vscode.window.showInformationMessage(
111-
dictionary.information_message.ADDED_FILES_TO_CONTEXT(
112-
newly_selected_count
113-
)
114-
)
115-
} else {
116-
vscode.window.showInformationMessage(
117-
t('command.search-files.success.added')
118-
)
119-
}
105+
vscode.window.showInformationMessage(t('common.success.context-updated'))
120106
}
121107

122108
return [

‎apps/editor/src/commands/select-clipboard-paths-command.ts‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -243,14 +243,8 @@ export const select_clipboard_paths_command = (
243243

244244
await workspace_provider.set_checked_files(paths_to_apply)
245245

246-
const newly_selected_count = final_selected_paths.filter(
247-
(p) => !currently_checked.includes(p)
248-
).length
249-
250246
vscode.window.showInformationMessage(
251-
dictionary.information_message.ADDED_FILES_TO_CONTEXT(
252-
newly_selected_count
253-
)
247+
t('common.success.context-updated')
254248
)
255249
} catch (error) {
256250
vscode.window.showErrorMessage(

‎apps/editor/src/commands/select-unstaged-files-command.ts‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,8 @@ export const select_unstaged_files_command = (
242242

243243
await workspace_provider.set_checked_files(paths_to_apply)
244244

245-
const newly_selected_count = selected_paths.filter(
246-
(p) => !currently_checked.includes(p)
247-
).length
248-
249245
vscode.window.showInformationMessage(
250-
dictionary.information_message.ADDED_FILES_TO_CONTEXT(
251-
newly_selected_count
252-
)
246+
t('common.success.context-updated')
253247
)
254248
return
255249
}

‎apps/editor/src/i18n/translations/commands/apply-response.ts‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,6 @@ export const translations = {
3535
hu: 'Erősítse meg a kontextusba foglalandó fájlokat',
3636
bg: 'Потвърдете файловете за включване в контекста'
3737
},
38-
'command.apply-response.relevant-files.success': {
39-
en: 'Context has been updated.',
40-
pl: 'Kontekst został zaktualizowany.',
41-
'zh-cn': '上下文已更新。',
42-
ja: 'コンテキストが更新されました。',
43-
'zh-tw': '上下文已更新。',
44-
de: 'Kontext wurde aktualisiert.',
45-
es: 'El contexto ha sido actualizado.',
46-
fr: 'Le contexte a été mis à jour.',
47-
'pt-br': 'O contexto foi atualizado.',
48-
ru: 'Контекст обновлен.',
49-
ko: '컨텍스트가 업데이트되었습니다.',
50-
it: 'Il contesto è stato aggiornato.',
51-
tr: 'Bağlam güncellendi.',
52-
cs: 'Kontext byl aktualizován.',
53-
hu: 'A kontextus frissítve lett.',
54-
bg: 'Контекстът е актуализиран.'
55-
},
5638
'command.apply-response.error.no-valid-response': {
5739
en: 'No valid response found in clipboard',
5840
pl: 'Nie znaleziono aplikowalnej odpowiedzi w schowku',

‎apps/editor/src/i18n/translations/commands/search-files.ts‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,5 @@ export const translations = {
1616
cs: 'Nebyla vybrána žádná složka.',
1717
hu: 'Nincs mappa kiválasztva.',
1818
bg: 'Не е избрана папка.'
19-
},
20-
'command.search-files.success.added': {
21-
en: 'Context has been updated.',
22-
pl: 'Kontekst został zaktualizowany.',
23-
'zh-cn': '上下文已更新。',
24-
ja: 'コンテキストが更新されました。',
25-
'zh-tw': '上下文已更新。',
26-
de: 'Kontext wurde aktualisiert.',
27-
es: 'El contexto ha sido actualizado.',
28-
fr: 'Le contexte a été mis à jour.',
29-
'pt-br': 'O contexto foi atualizado.',
30-
ru: 'Контекст был обновлен.',
31-
ko: '컨텍스트가 업데이트되었습니다.',
32-
it: 'Il contesto è stato aggiornato.',
33-
tr: 'Bağlam güncellendi.',
34-
cs: 'Kontext byl aktualizován.',
35-
hu: 'A kontextus frissítve lett.',
36-
bg: 'Контекстът е актуализиран.'
3719
}
3820
} as const

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,5 +340,23 @@ export const translations = {
340340
cs: 'Nebyly vybrány žádné soubory.',
341341
hu: 'Nincsenek fájlok kiválasztva.',
342342
bg: 'Няма избрани файлове.'
343+
},
344+
'common.success.context-updated': {
345+
en: 'Context has been updated.',
346+
pl: 'Kontekst został zaktualizowany.',
347+
'zh-cn': '上下文已更新。',
348+
ja: 'コンテキストが更新されました。',
349+
'zh-tw': '上下文已更新。',
350+
de: 'Kontext wurde aktualisiert.',
351+
es: 'El contexto ha sido actualizado.',
352+
fr: 'Le contexte a été mis à jour.',
353+
'pt-br': 'O contexto foi atualizado.',
354+
ru: 'Контекст был обновлен.',
355+
ko: '컨텍스트가 업데이트되었습니다.',
356+
it: 'Il contesto è stato aggiornato.',
357+
tr: 'Bağlam güncellendi.',
358+
cs: 'Kontext byl aktualizován.',
359+
hu: 'A kontextus frissítve lett.',
360+
bg: 'Контекстът е актуализиран.'
343361
}
344362
} as const

‎packages/shared/src/constants/dictionary.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ export const dictionary = {
6565
NO_UNSTAGED_FILES_FOUND: 'No unstaged files found.',
6666
NO_ACTIONABLE_UNSTAGED_FILES_FOUND:
6767
'No actionable unstaged files found (e.g. only deletions).',
68-
ADDED_FILES_TO_CONTEXT: (count: number) =>
69-
`Added ${count} file${count == 1 ? '' : 's'} to context.`,
7068
SELECTED_FILES: (count: number) =>
7169
`Selected ${count} file${count == 1 ? '' : 's'}.`,
7270
DELETED_CONTEXT_FROM_WORKSPACE_STATE: 'Deleted context.',

0 commit comments

Comments
 (0)