Skip to content

Commit 22df159

Browse files
committed
Always display the send request option in quick picks across features
- always show option 'Send request' in quick pick, when there is no configuration, show missing configuration notification └── apps └── editor └── src ├── commands │ ├── code-at-cursor-command │ │ ├── code-at-cursor-commands.ts │ │ └── utils │ │ ├── get-code-at-cursor-config.ts │ │ └── perform-code-at-cursor.ts │ └── generate-commit-message-commands │ ├── actions │ │ └── run-generate-action.ts │ ├── generate-commit-message-commands.ts │ └── utils │ ├── generate-commit-message-with-api.ts │ └── get-commit-message-config.ts ├── features │ └── search-files │ ├── search-files.ts │ ├── search-modes │ │ └── perform-intelligent-search-mode.ts │ └── utils │ └── prompt-for-config.ts ├── i18n │ ├── index.ts │ └── translations │ ├── common.ts │ └── utils │ ├── index.ts │ └── show-missing-configuration-notification.ts ├── utils │ └── show-missing-configuration-notification.ts └── views └── prompt └── backend ├── message-handlers │ ├── handle-patch-repair.ts │ ├── handle-voice-input.ts │ └── utils │ └── patch-repair-utils.ts └── prompt-view-provider.ts
1 parent d0e3d0b commit 22df159

4 files changed

Lines changed: 19 additions & 38 deletions

File tree

‎apps/editor/src/commands/code-at-cursor-command/utils/perform-code-at-cursor.ts‎

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -117,23 +117,15 @@ export const perform_code_at_cursor = async (params: {
117117
}
118118

119119
if (params.show_quick_pick) {
120-
const api_configurations =
121-
await providers_manager.get_api_configurations()
122-
const has_api_configurations = api_configurations.length > 0
123-
124120
action = await new Promise<string | undefined | 'back'>((resolve) => {
125121
const quick_pick = vscode.window.createQuickPick<
126122
vscode.QuickPickItem & { id: string }
127123
>()
128124
quick_pick.items = [
129-
...(has_api_configurations
130-
? [
131-
{
132-
label: t('common.action.send-request'),
133-
id: 'make-api'
134-
}
135-
]
136-
: []),
125+
{
126+
label: t('common.action.send-request'),
127+
id: 'make-api'
128+
},
137129
...(params.websocket_manager.is_connected_with_browser()
138130
? [
139131
{

‎apps/editor/src/commands/generate-commit-message-commands/actions/run-generate-action.ts‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import { display_token_count } from '@shared/utils/display-token-count'
2222
import { show_configurations_quick_pick } from '@/utils/show-configurations-quick-pick'
2323
import { dictionary } from '@shared/constants/dictionary'
2424
import { WebSocketManager } from '@/services/websocket-manager'
25-
import { ProvidersManager } from '@/services/providers-manager'
2625
import { get_response_preview_promise_resolve } from '@/commands/apply-response-command/utils/preview'
2726
import { normalize_path } from '@/utils/normalize-path'
2827
import { show_missing_configuration_notification } from '@/utils/show-missing-configuration-notification'
@@ -110,11 +109,6 @@ export const run_generate_action = async (params: {
110109
const action_enter_manually = t('common.action.enter-manually')
111110
const action_copy_prompt = t('common.action.copy-prompt')
112111

113-
const providers_manager = new ProvidersManager(params.extension_context)
114-
const api_configurations =
115-
await providers_manager.get_api_configurations()
116-
const has_api_configurations = api_configurations.length > 0
117-
118112
let go_back_to_prompt_data = false
119113
let action_completed = false
120114
let final_api_prompt: string | undefined = undefined
@@ -131,9 +125,7 @@ export const run_generate_action = async (params: {
131125
vscode.QuickPickItem & { id: string }
132126
>()
133127
quick_pick.items = [
134-
...(has_api_configurations
135-
? [{ label: action_make_api, id: 'make-api' }]
136-
: []),
128+
{ label: action_make_api, id: 'make-api' },
137129
...(params.websocket_manager.is_connected_with_browser()
138130
? [{ label: action_autofill_chatbot, id: 'autofill' }]
139131
: []),

‎apps/editor/src/features/search-files/search-modes/perform-intelligent-search-mode.ts‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,10 @@ export const perform_intelligent_search_mode = async (params: {
128128
vscode.QuickPickItem & { id: string }
129129
>()
130130
quick_pick.items = [
131-
...(has_api_configurations
132-
? [
133-
{
134-
label: t('common.action.send-request'),
135-
id: 'make-api'
136-
}
137-
]
138-
: []),
131+
{
132+
label: t('common.action.send-request'),
133+
id: 'make-api'
134+
},
139135
...(params.websocket_manager.is_connected_with_browser()
140136
? [
141137
{
@@ -361,6 +357,12 @@ export const perform_intelligent_search_mode = async (params: {
361357
}
362358

363359
if (action == 'make-api') {
360+
if (!has_api_configurations) {
361+
show_missing_configuration_notification('api')
362+
go_back_to_action = true
363+
continue
364+
}
365+
364366
let show_quick_pick = false
365367
let break_outer = false
366368
let final_result:

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ export const handle_patch_repair = async (params: {
127127
)
128128

129129
const api_configurations = await providers_manager.get_api_configurations()
130-
const has_api_configurations = api_configurations.length > 0
131130

132131
let skip_action_quick_pick = false
133132
if (params.is_auto_run) {
@@ -154,14 +153,10 @@ export const handle_patch_repair = async (params: {
154153
vscode.QuickPickItem & { id: string }
155154
>()
156155
quick_pick.items = [
157-
...(has_api_configurations
158-
? [
159-
{
160-
label: t('common.action.send-request'),
161-
id: 'make-api'
162-
}
163-
]
164-
: []),
156+
{
157+
label: t('common.action.send-request'),
158+
id: 'make-api'
159+
},
165160
...(params.prompt_view_provider.websocket_server_instance.is_connected_with_browser()
166161
? [
167162
{

0 commit comments

Comments
 (0)