Skip to content

Commit 1cc034a

Browse files
committed
Add agentic search action to empty context warning notification
- to 'context cannot be empty' warning notification shown from prompt view > Edit mode, when context is empty, add button 'Agentic Search'. It should behave like if was run from the prompt view "Agentic Search" button in the status bar placed under the prompt field. - move [Fragment] to `apps/editor/src/i18n/translations/views/common/handlers/utils/show-context-cannot-be-empty-warning.ts` - 'add invocation' quick pick should use 'Agents' title
1 parent ae231a1 commit 1cc034a

11 files changed

Lines changed: 60 additions & 35 deletions

File tree

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

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,6 @@ export const translations = {
1717
hu: 'Az utasítások nem lehetnek üresek.',
1818
bg: 'Инструкциите не могат да бъдат празни.'
1919
},
20-
'views.common.handlers.common.context-cannot-be-empty': {
21-
en: 'Context cannot be empty.',
22-
pl: 'Kontekst nie może być pusty.',
23-
'zh-cn': '上下文不能为空。',
24-
ja: 'コンテキストを空にすることはできません。',
25-
'zh-tw': '上下文不能為空。',
26-
de: 'Kontext darf nicht leer sein.',
27-
es: 'El contexto no puede estar vacío.',
28-
fr: 'Le contexte ne peut pas être vide.',
29-
'pt-br': 'O contexto não pode estar vazio.',
30-
ru: 'Контекст не может быть пустым.',
31-
ko: '컨텍스트는 비워 둘 수 없습니다.',
32-
it: 'Il contesto non può essere vuoto.',
33-
tr: 'Bağlam boş olamaz.',
34-
cs: 'Kontext nemůže být prázdný.',
35-
hu: 'A kontextus nem lehet üres.',
36-
bg: 'Контекстът не може да бъде празен.'
37-
},
3820
'views.common.handlers.common.confirm-discard-unsaved-changes': {
3921
en: 'Discard unsaved changes to the {item_type}?',
4022
pl: 'Odrzucić niezapisane zmiany w {item_type}?',
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { translations as common } from './common'
2+
import { translations as utils } from './utils'
23

34
export const translations = {
4-
...common
5+
...common,
6+
...utils
57
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { translations as show_context_cannot_be_empty_warning } from './show-context-cannot-be-empty-warning'
2+
3+
export const translations = {
4+
...show_context_cannot_be_empty_warning
5+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export const translations = {
2+
'views.common.handlers.utils.show-context-cannot-be-empty-warning.context-cannot-be-empty':
3+
{
4+
en: 'Context cannot be empty.',
5+
pl: 'Kontekst nie może być pusty.',
6+
'zh-cn': '上下文不能为空。',
7+
ja: 'コンテキストを空にすることはできません。',
8+
'zh-tw': '上下文不能為空。',
9+
de: 'Kontext darf nicht leer sein.',
10+
es: 'El contexto no puede estar vacío.',
11+
fr: 'Le contexte ne peut pas être vide.',
12+
'pt-br': 'O contexto não pode estar vazio.',
13+
ru: 'Контекст не может быть пустым.',
14+
ko: '컨텍스트는 비워 둘 수 없습니다.',
15+
it: 'Il contesto non può essere vuoto.',
16+
tr: 'Bağlam boş olamaz.',
17+
cs: 'Kontext nemůže být prázdný.',
18+
hu: 'A kontextus nem lehet üres.',
19+
bg: 'Контекстът не може да бъде празен.'
20+
}
21+
} as const

‎apps/editor/src/utils/agentic-cli-invocation/invoke-agentic-cli.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ export const invoke_agentic_cli = async (params: {
10021002
}
10031003

10041004
const selection = await show_agent_quick_pick({
1005-
title: t('utils.agentic-cli-invocation.agent.add-invocation'),
1005+
title: t('utils.agentic-cli-invocation.agent.agents'),
10061006
active_config_name: last_invocation_config_name,
10071007
show_back_button: false,
10081008
ignore_focus_out: false,

‎apps/editor/src/views/prompt/backend/message-handlers/handle-autofill.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { t } from '@/i18n'
1616
import { show_incomplete_setup_warning } from '@/utils/show-missing-configuration-notification'
1717
import { CHATBOTS } from '@shared/constants/chatbots'
1818
import { update_last_used_web_configuration } from './utils/update-last-used-web-configuration'
19+
import { show_context_cannot_be_empty_warning } from './utils/show-context-cannot-be-empty-warning'
1920

2021
export const handle_autofill = async (params: {
2122
prompt_view_provider: PromptViewProvider
@@ -74,9 +75,7 @@ export const handle_autofill = async (params: {
7475
params.prompt_view_provider.web_prompt_type === 'edit' &&
7576
!collected_files
7677
) {
77-
vscode.window.showWarningMessage(
78-
t('views.common.handlers.common.context-cannot-be-empty')
79-
)
78+
await show_context_cannot_be_empty_warning(params.prompt_view_provider)
8079
return
8180
}
8281

‎apps/editor/src/views/prompt/backend/message-handlers/handle-copy-prompt.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
} from '@/constants/edit-format-instructions'
1010
import { PromptBuilder } from '@/utils/prompt-builder'
1111
import { t } from '@/i18n'
12+
import { show_context_cannot_be_empty_warning } from './utils/show-context-cannot-be-empty-warning'
1213

1314
export const handle_copy_prompt = async (params: {
1415
prompt_view_provider: PromptViewProvider
@@ -27,9 +28,7 @@ export const handle_copy_prompt = async (params: {
2728
})
2829

2930
if (!collected_files) {
30-
vscode.window.showWarningMessage(
31-
t('views.common.handlers.common.context-cannot-be-empty')
32-
)
31+
await show_context_cannot_be_empty_warning(params.prompt_view_provider)
3332
return
3433
}
3534

‎apps/editor/src/views/prompt/backend/message-handlers/handle-invoke-agentic-cli.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
} from '@/constants/state-keys'
1212
import { InvokeAgenticCliMessage } from '@/views/prompt/types/messages'
1313
import { apply_response } from '@/features/apply-response/apply-response'
14+
import { show_context_cannot_be_empty_warning } from './utils/show-context-cannot-be-empty-warning'
1415

1516
export const handle_invoke_agentic_cli = async (
1617
prompt_view_provider: PromptViewProvider,
@@ -29,9 +30,7 @@ export const handle_invoke_agentic_cli = async (
2930
prompt_view_provider.cli_prompt_type === 'edit' &&
3031
!prompt_view_provider.workspace_provider.get_selected_files().length
3132
) {
32-
vscode.window.showWarningMessage(
33-
t('views.common.handlers.common.context-cannot-be-empty')
34-
)
33+
await show_context_cannot_be_empty_warning(prompt_view_provider)
3534
return
3635
}
3736

‎apps/editor/src/views/prompt/backend/message-handlers/handle-make-api-call.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { PROVIDERS } from '@/constants/providers'
2222
import { get_api_configuration } from '@/utils/get-api-configuration'
2323
import { show_incomplete_setup_warning } from '@/utils/show-missing-configuration-notification'
2424
import { apply_response } from '@/features/apply-response/apply-response'
25+
import { show_context_cannot_be_empty_warning } from './utils/show-context-cannot-be-empty-warning'
2526

2627
export const handle_make_api_call = async (
2728
prompt_view_provider: PromptViewProvider,
@@ -63,9 +64,7 @@ export const handle_make_api_call = async (
6364
})
6465

6566
if (!collected_files) {
66-
vscode.window.showWarningMessage(
67-
t('views.common.handlers.common.context-cannot-be-empty')
68-
)
67+
await show_context_cannot_be_empty_warning(prompt_view_provider)
6968
return
7069
}
7170

‎apps/editor/src/views/prompt/backend/message-handlers/handle-preview-prompt.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { PromptBuilder } from '@/utils/prompt-builder'
1111
import { preview_text_in_temp_file } from '../utils/preview-text-in-temp-file'
1212
import * as vscode from 'vscode'
1313
import { t } from '@/i18n'
14+
import { show_context_cannot_be_empty_warning } from './utils/show-context-cannot-be-empty-warning'
1415

1516
export const handle_preview_prompt = async (params: {
1617
prompt_view_provider: PromptViewProvider
@@ -46,9 +47,7 @@ export const handle_preview_prompt = async (params: {
4647
})
4748

4849
if (!collected_files) {
49-
vscode.window.showWarningMessage(
50-
t('views.common.handlers.common.context-cannot-be-empty')
51-
)
50+
await show_context_cannot_be_empty_warning(params.prompt_view_provider)
5251
return
5352
}
5453

0 commit comments

Comments
 (0)