Skip to content

Commit 583e1ac

Browse files
committed
Add settings link when no templates are found in template quick pick
- don't show 'templates' quick pick, when there are no templates to show. Display appropriate notification. - `apps/editor/src/views/prompt/backend/message-handlers/handle-template-quick-pick.ts`, in the notification [Fragment] a button 'Open settings' - here [Pasted text] is it possible to open settings at 'Prompt Field' group? └── apps └── editor └── src ├── extension.ts ├── i18n │ └── translations │ └── views │ └── prompt │ └── handlers │ ├── copy-prompt.ts │ ├── delete-task.ts │ ├── handle-pick-api-reasoning-effort.ts │ ├── handle-template-quick-pick.ts │ ├── handle-undo.ts │ ├── hash-sign.ts │ ├── index.ts │ ├── make-api-call.ts │ ├── select-edit-format.ts │ ├── utils │ │ ├── index.ts │ │ └── symbols │ │ ├── git │ │ │ ├── index.ts │ │ │ └── replace-git-symbols.ts │ │ └── index.ts │ └── voice-input.ts └── views ├── prompt │ └── backend │ └── message-handlers │ ├── handle-at-sign-quick-pick │ │ └── handle-at-sign-quick-pick.ts │ ├── handle-autofill.ts │ ├── handle-copy-prompt.ts │ ├── handle-delete-task.ts │ ├── handle-hash-sign-quick-pick │ │ ├── handle-hash-sign-quick-pick.ts │ │ └── symbols │ │ ├── changes-symbol.ts │ │ ├── saved-context-symbol.ts │ │ └── skill-symbol.ts │ ├── handle-make-api-call.ts │ ├── handle-paste-url.ts │ ├── handle-template-quick-pick.ts │ ├── handle-undo.ts │ └── utils │ └── intelligent-update-utils.ts └── settings ├── backend │ └── settings-view-provider.ts └── frontend ├── App.tsx ├── Home │ ├── Home.tsx │ ├── index.ts │ └── sections │ ├── ApiConfigurationsSection.tsx │ ├── GeneralSection.tsx │ ├── ModelProvidersSection.tsx │ └── WebConfigurationsSection.tsx ├── Settings.tsx └── hooks ├── use-api-configuration-editing.ts ├── use-model-provider-editing.ts ├── use-settings.ts └── use-web-configuration-editing.ts
1 parent 5e96f0b commit 583e1ac

3 files changed

Lines changed: 59 additions & 1 deletion

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
export const translations = {
2+
'views.prompt.handlers.handle-template-quick-pick.no-templates-found': {
3+
en: 'No templates found.',
4+
pl: 'Nie znaleziono szablonów.',
5+
'zh-cn': '未找到模板。',
6+
ja: 'テンプレートが見つかりません。',
7+
'zh-tw': '未找到範本。',
8+
de: 'Keine Vorlagen gefunden.',
9+
es: 'No se encontraron plantillas.',
10+
fr: 'Aucun modèle trouvé.',
11+
'pt-br': 'Nenhum modelo encontrado.',
12+
ru: 'Шаблоны не найдены.',
13+
ko: '템플릿을 찾을 수 없습니다.',
14+
it: 'Nessun modello trovato.',
15+
tr: 'Şablon bulunamadı.',
16+
cs: 'Nebyly nalezeny žádné šablony.',
17+
hu: 'Nem találhatók sablonok.',
18+
bg: 'Не са намерени шаблони.'
19+
},
20+
'views.prompt.handlers.handle-template-quick-pick.open-settings': {
21+
en: 'Open settings',
22+
pl: 'Otwórz ustawienia',
23+
'zh-cn': '打开设置',
24+
ja: '設定を開く',
25+
'zh-tw': '開啟設定',
26+
de: 'Einstellungen öffnen',
27+
es: 'Abrir configuración',
28+
fr: 'Ouvrir les paramètres',
29+
'pt-br': 'Abrir configurações',
30+
ru: 'Открыть настройки',
31+
ko: '설정 열기',
32+
it: 'Apri impostazioni',
33+
tr: 'Ayarları Aç',
34+
cs: 'Otevřít nastavení',
35+
hu: 'Beállítások megnyitása',
36+
bg: 'Отваряне на настройките'
37+
}
38+
} as const

‎apps/editor/src/i18n/translations/views/prompt/handlers/index.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { translations as copy_prompt } from './copy-prompt'
77
import { translations as handle_undo } from './handle-undo'
88
import { translations as utils } from './utils'
99
import { translations as handle_pick_api_reasoning_effort } from './handle-pick-api-reasoning-effort'
10+
import { translations as handle_template_quick_pick } from './handle-template-quick-pick'
1011

1112
export const translations = {
1213
...delete_task,
@@ -17,5 +18,6 @@ export const translations = {
1718
...copy_prompt,
1819
...handle_undo,
1920
...utils,
20-
...handle_pick_api_reasoning_effort
21+
...handle_pick_api_reasoning_effort,
22+
...handle_template_quick_pick
2123
}

‎apps/editor/src/views/prompt/backend/message-handlers/handle-template-quick-pick.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,24 @@ export const handle_template_quick_pick = async (
4343
const config = vscode.workspace.getConfiguration('codeWebChat')
4444
const templates = config.get<Template[]>(templates_key, []) || []
4545

46+
if (!templates.length) {
47+
prompt_view_provider.send_message({ command: 'FOCUS_PROMPT_FIELD' })
48+
const selection = await vscode.window.showInformationMessage(
49+
t('views.prompt.handlers.handle-template-quick-pick.no-templates-found'),
50+
t('views.prompt.handlers.handle-template-quick-pick.open-settings')
51+
)
52+
if (
53+
selection ==
54+
t('views.prompt.handlers.handle-template-quick-pick.open-settings')
55+
) {
56+
vscode.commands.executeCommand(
57+
'codeWebChat.settings',
58+
'section:general:group:prompt-field'
59+
)
60+
}
61+
return
62+
}
63+
4664
const templates_quick_pick = vscode.window.createQuickPick<
4765
vscode.QuickPickItem & { template?: Template; index?: number }
4866
>()

0 commit comments

Comments
 (0)