Skip to content

Commit cc62759

Browse files
committed
Rename edit-context prompt type and related keys to edit-files throughout the codebase
- rename file names and function names (only) '...edit context...' to '...edit files...'
1 parent c55f874 commit cc62759

30 files changed

Lines changed: 117 additions & 118 deletions

‎apps/browser/src/content-scripts/send-prompt-content-script/send-prompt-content-script.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ const main = async () => {
200200
edit_format?: string
201201
prompt_type?:
202202
| 'ask-about-context'
203-
| 'edit-context'
203+
| 'edit-files'
204204
| 'code-at-cursor'
205205
| 'find-relevant-files'
206206
| 'no-context'
@@ -235,7 +235,7 @@ const main = async () => {
235235

236236
if (chatbot?.setup_observer) {
237237
const inject_button =
238-
stored_data.prompt_type == 'edit-context' ||
238+
stored_data.prompt_type == 'edit-files' ||
239239
stored_data.prompt_type == 'code-at-cursor' ||
240240
stored_data.prompt_type == 'find-relevant-files'
241241

‎apps/editor/src/constants/state-keys.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const WEB_MODE_STATE_KEY = 'web-mode'
3737
export const API_MODE_STATE_KEY = 'api-mode'
3838
export const PANEL_MODE_STATE_KEY = 'panel-mode'
3939

40-
export const INSTRUCTIONS_EDIT_CONTEXT_STATE_KEY = 'instructions-edit-context'
40+
export const INSTRUCTIONS_EDIT_FILES_STATE_KEY = 'instructions-edit-files'
4141
export const INSTRUCTIONS_ASK_STATE_KEY = 'instructions-ask'
4242
export const INSTRUCTIONS_NO_CONTEXT_STATE_KEY = 'instructions-no-context'
4343
export const INSTRUCTIONS_CODE_AT_CURSOR_STATE_KEY =
@@ -62,7 +62,7 @@ export const RECENTLY_USED_CODE_AT_CURSOR_CONFIG_IDS_STATE_KEY =
6262
export const RECENTLY_USED_FIND_RELEVANT_FILES_CONFIG_IDS_STATE_KEY =
6363
'recently-used-find-relevant-files-config-ids'
6464
export const RECENTLY_USED_EDIT_CONTEXT_CONFIG_IDS_STATE_KEY =
65-
'recently-used-edit-context-config-ids'
65+
'recently-used-edit-files-config-ids'
6666
export const RECENTLY_USED_COMMIT_MESSAGES_CONFIG_IDS_STATE_KEY =
6767
'recently-used-commit-messages-config-ids'
6868
export const RECENTLY_USED_INTELLIGENT_UPDATE_CONFIG_IDS_STATE_KEY =

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export const handle_copy_prompt = async (params: {
117117

118118
let system_instructions_xml = ''
119119

120-
if (params.panel_provider.web_prompt_type == 'edit-context') {
120+
if (params.panel_provider.web_prompt_type == 'edit-files') {
121121
const edit_format =
122122
params.panel_provider.mode == MODE.WEB
123123
? params.panel_provider.chat_edit_format

apps/editor/src/views/panel/backend/message-handlers/handle-edit-context.ts renamed to apps/editor/src/views/panel/backend/message-handlers/handle-edit-files.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { replace_symbols } from '@/views/panel/backend/utils/symbols/replace-sym
2929
import { split_recent_and_rest_configurations } from '@/views/panel/backend/utils/split-recent-and-rest-configurations'
3030
import { t } from '@/i18n'
3131

32-
const get_edit_context_api_configuration = async (params: {
32+
const get_edit_files_api_configuration = async (params: {
3333
api_providers_manager: ModelProvidersManager
3434
show_quick_pick?: boolean
3535
context: vscode.ExtensionContext
@@ -74,7 +74,7 @@ const get_edit_context_api_configuration = async (params: {
7474
if (params.panel_provider) {
7575
params.panel_provider.send_message({
7676
command: 'SELECTED_API_CONFIGURATION_CHANGED',
77-
prompt_type: 'edit-context',
77+
prompt_type: 'edit-files',
7878
id: params.api_configuration_id
7979
})
8080
}
@@ -225,7 +225,7 @@ const get_edit_context_api_configuration = async (params: {
225225
if (params.panel_provider) {
226226
params.panel_provider.send_message({
227227
command: 'SELECTED_API_CONFIGURATION_CHANGED',
228-
prompt_type: 'edit-context',
228+
prompt_type: 'edit-files',
229229
id: selected.id!
230230
})
231231
}
@@ -273,7 +273,7 @@ const get_edit_context_api_configuration = async (params: {
273273
dictionary.error_message.API_PROVIDER_NOT_FOUND
274274
)
275275
Logger.warn({
276-
function_name: 'get_edit_context_api_configuration',
276+
function_name: 'get_edit_files_api_configuration',
277277
message: 'API provider not found for Edit Context tool.'
278278
})
279279
return
@@ -285,7 +285,7 @@ const get_edit_context_api_configuration = async (params: {
285285
}
286286
}
287287

288-
export const handle_edit_context = async (
288+
export const handle_edit_files = async (
289289
panel_provider: PanelProvider,
290290
message: EditContextMessage
291291
): Promise<void> => {
@@ -335,7 +335,7 @@ export const handle_edit_context = async (
335335
let should_show_quick_pick = message.use_quick_pick
336336

337337
while (true) {
338-
const api_configuration_result = await get_edit_context_api_configuration({
338+
const api_configuration_result = await get_edit_files_api_configuration({
339339
api_providers_manager,
340340
show_quick_pick: should_show_quick_pick,
341341
context: panel_provider.context,
@@ -463,7 +463,7 @@ export const handle_edit_context = async (
463463
return false
464464
}
465465
Logger.error({
466-
function_name: 'handle_edit_context',
466+
function_name: 'handle_edit_files',
467467
message: 'edit context task error',
468468
data: error
469469
})

‎apps/editor/src/views/panel/backend/message-handlers/handle-preview-web-configuration.ts‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ export const handle_preview_web_configuration = async (
6666

6767
text_to_send = `<files>\n${context_text}<file path="${relative_path}">\n<![CDATA[\n${text_before_cursor}${missing_text_tag}${text_after_cursor}\n]]>\n</file>\n</files>\n${skill_definitions}${system_instructions}`
6868
} else if (panel_provider.web_prompt_type != 'code-at-cursor') {
69-
7069
const collected =
7170
panel_provider.web_prompt_type != 'no-context'
7271
? await files_collector.collect_files({})
@@ -82,7 +81,7 @@ export const handle_preview_web_configuration = async (
8281
})
8382

8483
let system_instructions_xml = ''
85-
if (panel_provider.web_prompt_type == 'edit-context') {
84+
if (panel_provider.web_prompt_type == 'edit-files') {
8685
const config = vscode.workspace.getConfiguration('codeWebChat')
8786
const instructions_key = {
8887
whole: 'editFormatInstructionsWhole',
@@ -132,12 +131,13 @@ export const handle_preview_web_configuration = async (
132131
new_url: message.web_configuration.new_url
133132
}
134133

135-
const sent = await panel_provider.websocket_server_instance.preview_web_configuration({
136-
instruction: text_to_send,
137-
web_configuration: web_configuration_for_preview,
138-
prompt_type: panel_provider.web_prompt_type,
139-
raw_instructions: current_instructions
140-
})
134+
const sent =
135+
await panel_provider.websocket_server_instance.preview_web_configuration({
136+
instruction: text_to_send,
137+
web_configuration: web_configuration_for_preview,
138+
prompt_type: panel_provider.web_prompt_type,
139+
raw_instructions: current_instructions
140+
})
141141

142142
if (sent) {
143143
panel_provider.send_message({

apps/editor/src/views/panel/backend/message-handlers/handle-return-home-and-switch-to-edit-context.ts renamed to apps/editor/src/views/panel/backend/message-handlers/handle-return-home-and-switch-to-edit-files.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@ import { MODE } from '../../types/main-view-mode'
22
import { PanelProvider } from '../panel-provider'
33
import { API_MODE_STATE_KEY, WEB_MODE_STATE_KEY } from '@/constants/state-keys'
44

5-
export const handle_return_home_and_switch_to_edit_context = async (
5+
export const handle_return_home_and_switch_to_edit_files = async (
66
panel_provider: PanelProvider
77
) => {
88
panel_provider.send_message({ command: 'RETURN_HOME' })
99
if (panel_provider.mode == MODE.WEB) {
10-
panel_provider.web_prompt_type = 'edit-context'
10+
panel_provider.web_prompt_type = 'edit-files'
1111
await panel_provider.context.workspaceState.update(
1212
WEB_MODE_STATE_KEY,
13-
'edit-context'
13+
'edit-files'
1414
)
1515
panel_provider.send_message({
1616
command: 'WEB_PROMPT_TYPE',
17-
prompt_type: 'edit-context'
17+
prompt_type: 'edit-files'
1818
})
1919
} else {
20-
panel_provider.api_prompt_type = 'edit-context'
20+
panel_provider.api_prompt_type = 'edit-files'
2121
await panel_provider.context.workspaceState.update(
2222
API_MODE_STATE_KEY,
23-
'edit-context'
23+
'edit-files'
2424
)
2525
panel_provider.send_message({
2626
command: 'API_PROMPT_TYPE',
27-
prompt_type: 'edit-context'
27+
prompt_type: 'edit-files'
2828
})
2929
}
3030
panel_provider.update_providers_shrink_mode()

‎apps/editor/src/views/panel/backend/message-handlers/handle-save-history.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const handle_save_history = async (
1919
case 'ask-about-context':
2020
key = HISTORY_ASK_STATE_KEY
2121
break
22-
case 'edit-context':
22+
case 'edit-files':
2323
key = HISTORY_EDIT_STATE_KEY
2424
break
2525
case 'no-context':

‎apps/editor/src/views/panel/backend/message-handlers/handle-save-instructions.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
import {
77
INSTRUCTIONS_ASK_STATE_KEY,
88
INSTRUCTIONS_CODE_AT_CURSOR_STATE_KEY,
9-
INSTRUCTIONS_EDIT_CONTEXT_STATE_KEY,
9+
INSTRUCTIONS_EDIT_FILES_STATE_KEY,
1010
INSTRUCTIONS_NO_CONTEXT_STATE_KEY,
1111
INSTRUCTIONS_FIND_RELEVANT_FILES_STATE_KEY
1212
} from '@/constants/state-keys'
@@ -24,10 +24,10 @@ export const handle_save_instructions = async (
2424
INSTRUCTIONS_ASK_STATE_KEY,
2525
instruction_state
2626
)
27-
} else if (prompt_type == 'edit-context') {
27+
} else if (prompt_type == 'edit-files') {
2828
panel_provider.edit_context_instructions = instruction_state
2929
await panel_provider.context.workspaceState.update(
30-
INSTRUCTIONS_EDIT_CONTEXT_STATE_KEY,
30+
INSTRUCTIONS_EDIT_FILES_STATE_KEY,
3131
instruction_state
3232
)
3333
} else if (prompt_type == 'no-context') {

‎apps/editor/src/views/panel/backend/message-handlers/handle-send-to-browser.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export const handle_send_to_browser = async (params: {
158158
})
159159

160160
let system_instructions_xml = ''
161-
if (params.panel_provider.web_prompt_type == 'edit-context') {
161+
if (params.panel_provider.web_prompt_type == 'edit-files') {
162162
const config = vscode.workspace.getConfiguration('codeWebChat')
163163
const instructions_key = {
164164
whole: 'editFormatInstructionsWhole',
@@ -196,7 +196,7 @@ export const handle_send_to_browser = async (params: {
196196
raw_instructions: current_instructions,
197197
prompt_type: params.panel_provider.web_prompt_type,
198198
edit_format:
199-
params.panel_provider.web_prompt_type == 'edit-context'
199+
params.panel_provider.web_prompt_type == 'edit-files'
200200
? params.panel_provider.chat_edit_format
201201
: undefined,
202202
invocation_count: params.invocation_count
@@ -431,7 +431,7 @@ const resolve_web_configuration = async (params: {
431431
params.panel_provider.ask_about_context_instructions.instructions[
432432
params.panel_provider.ask_about_context_instructions.active_index
433433
] || ''
434-
} else if (params.panel_provider.web_prompt_type == 'edit-context') {
434+
} else if (params.panel_provider.web_prompt_type == 'edit-files') {
435435
current_instructions =
436436
params.panel_provider.edit_context_instructions.instructions[
437437
params.panel_provider.edit_context_instructions.active_index

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const handle_show_prompt_template_quick_pick = async (
2929
case 'ask-about-context':
3030
prompt_templates_key = 'promptTemplatesForAskAboutContext'
3131
break
32-
case 'edit-context':
32+
case 'edit-files':
3333
prompt_templates_key = 'promptTemplatesForEditContext'
3434
break
3535
case 'code-at-cursor':

0 commit comments

Comments
 (0)