Skip to content

Commit 03aae3c

Browse files
committed
Simplify the find relevant files workflow by renaming instruction settings and removing the intermediate actions modal
- rename 'find relevant files instructions prefix' to 'find relevant files instructions' - don't wait for the decision in [Fragment], just switch to edit context. Remove unused resolver logic. Instead of UiAutoClosingWithActionsModal, use UiAutoClosingModal. Remove the autoclosing modal component.
1 parent 92e1ffe commit 03aae3c

27 files changed

Lines changed: 116 additions & 303 deletions

‎apps/editor/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@
864864
"type": "string",
865865
"scope": "resource"
866866
},
867-
"codeWebChat.findRelevantFilesInstructionsPrefix": {
867+
"codeWebChat.findRelevantFilesInstructions": {
868868
"type": "string",
869869
"scope": "resource"
870870
},

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

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -192,19 +192,12 @@ export const process_chat_response = async (
192192
}
193193

194194
panel_provider.send_message({
195-
command: 'SHOW_AUTO_CLOSING_WITH_ACTIONS_MODAL',
195+
command: 'SHOW_AUTO_CLOSING_MODAL',
196196
title: t('command.apply-chat-response.relevant-files.success'),
197-
type: 'success',
198-
action_label: 'Edit context'
197+
type: 'success'
199198
})
200199

201-
const action = await new Promise<'action' | 'close'>((resolve) => {
202-
panel_provider.auto_closing_action_resolver = resolve
203-
})
204-
205-
if (action == 'action') {
206-
await panel_provider.switch_to_edit_context()
207-
}
200+
await panel_provider.switch_to_edit_context()
208201
}
209202

210203
return null

‎apps/editor/src/constants/instructions.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const intelligent_update_instructions =
2828
export const commit_message_instructions =
2929
"Write a brief and precise summary for the changes, limited to a single sentence. Because the summary will be used for a commit message, don't use any markdown formatting and don't include a trailing dot. Use an imperative tone to ensure clarity and focus on the primary change or purpose."
3030

31-
export const find_relevant_files_instructions_prefix =
31+
export const find_relevant_files_instructions =
3232
"Find all files building modules of the task's scope."
3333

3434
export const find_relevant_files_format = `<system>

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { replace_website_symbol } from '../utils/replace-website-symbol'
1515
import { replace_fragment_symbol } from '../utils/replace-fragment-symbol'
1616
import {
1717
code_at_cursor_instructions_for_panel,
18-
find_relevant_files_instructions_prefix,
18+
find_relevant_files_instructions,
1919
find_relevant_files_format
2020
} from '@/constants/instructions'
2121
import { apply_preset_affixes_to_instruction } from '@/utils/apply-preset-affixes'
@@ -290,12 +290,12 @@ export const handle_copy_prompt = async (params: {
290290
}
291291
} else if (is_in_find_relevant_files_prompt_type) {
292292
const config = vscode.workspace.getConfiguration('codeWebChat')
293-
const config_find_relevant_files_instructions_prefix = config.get<string>(
294-
'findRelevantFilesInstructionsPrefix'
293+
const config_find_relevant_files_instructions = config.get<string>(
294+
'findRelevantFilesInstructions'
295295
)
296296
const instructions_to_use =
297-
config_find_relevant_files_instructions_prefix ||
298-
find_relevant_files_instructions_prefix
297+
config_find_relevant_files_instructions ||
298+
find_relevant_files_instructions
299299
system_instructions_xml = `${instructions_to_use}\n${find_relevant_files_format}`
300300
}
301301

‎apps/editor/src/views/panel/backend/message-handlers/handle-find-relevant-files.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { apply_reasoning_effort } from '@/utils/apply-reasoning-effort'
2929
import { FindRelevantFilesMessage } from '@/views/panel/types/messages'
3030
import { dictionary } from '@shared/constants/dictionary'
3131
import {
32-
find_relevant_files_instructions_prefix,
32+
find_relevant_files_instructions,
3333
find_relevant_files_format
3434
} from '@/constants/instructions'
3535
import { build_user_content } from '@/utils/build-user-content'
@@ -432,12 +432,12 @@ export const handle_find_relevant_files = async (
432432
const endpoint_url = provider.base_url
433433

434434
const config = vscode.workspace.getConfiguration('codeWebChat')
435-
const config_find_relevant_files_instructions_prefix = config.get<string>(
436-
'findRelevantFilesInstructionsPrefix'
435+
const config_find_relevant_files_instructions = config.get<string>(
436+
'findRelevantFilesInstructions'
437437
)
438438
const instructions_to_use =
439-
config_find_relevant_files_instructions_prefix ||
440-
find_relevant_files_instructions_prefix
439+
config_find_relevant_files_instructions ||
440+
find_relevant_files_instructions
441441
const system_instructions_xml = `${instructions_to_use}\n${find_relevant_files_format}`
442442

443443
const part1 = `<files>\n${collected.other_files}`

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { replace_pasted_text_symbol } from '../utils/replace-pasted-text-symbol'
1515
import { replace_fragment_symbol } from '../utils/replace-fragment-symbol'
1616
import {
1717
code_at_cursor_instructions_for_panel,
18-
find_relevant_files_instructions_prefix,
18+
find_relevant_files_instructions,
1919
find_relevant_files_format_for_panel
2020
} from '@/constants/instructions'
2121
import {
@@ -327,11 +327,12 @@ export const handle_send_to_browser = async (params: {
327327
params.panel_provider.web_prompt_type == 'find-relevant-files'
328328
) {
329329
const config = vscode.workspace.getConfiguration('codeWebChat')
330-
const config_find_relevant_files_instructions_prefix =
331-
config.get<string>('findRelevantFilesInstructionsPrefix')
330+
const config_find_relevant_files_instructions = config.get<string>(
331+
'findRelevantFilesInstructions'
332+
)
332333
const instructions_to_use =
333-
config_find_relevant_files_instructions_prefix ||
334-
find_relevant_files_instructions_prefix
334+
config_find_relevant_files_instructions ||
335+
find_relevant_files_instructions
335336
system_instructions_xml = `${instructions_to_use}\n${find_relevant_files_format_for_panel}`
336337
}
337338

‎apps/editor/src/views/panel/backend/panel-provider.ts‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,6 @@ export class PanelProvider implements vscode.WebviewViewProvider {
188188
public relevant_files_choice_resolver:
189189
| ((files: string[] | undefined) => void)
190190
| undefined = undefined
191-
public auto_closing_action_resolver:
192-
| ((action: 'action' | 'close') => void)
193-
| undefined = undefined
194191

195192
public get current_ask_about_context_instruction(): string {
196193
return (
@@ -1020,13 +1017,6 @@ export class PanelProvider implements vscode.WebviewViewProvider {
10201017
this.relevant_files_choice_resolver(message.files)
10211018
this.relevant_files_choice_resolver = undefined
10221019
}
1023-
} else if (
1024-
message.command == 'AUTO_CLOSING_WITH_ACTIONS_MODAL_RESPONSE'
1025-
) {
1026-
if (this.auto_closing_action_resolver) {
1027-
this.auto_closing_action_resolver(message.action)
1028-
this.auto_closing_action_resolver = undefined
1029-
}
10301020
}
10311021
} catch (error: any) {
10321022
Logger.error({

‎apps/editor/src/views/panel/frontend/Panel.tsx‎

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { ApiManagerModal as UiApiManagerModal } from '@ui/components/editor/pane
1616
import { QRCodeModal as UiQRCodeModal } from '@ui/components/editor/panel/modals/QRCodeModal'
1717
import { RelevantFilesModal as UiRelevantFilesModal } from '@ui/components/editor/panel/modals/RelevantFilesModal'
1818
import { AutoClosingModal as UiAutoClosingModal } from '@ui/components/editor/panel/modals/AutoClosingModal'
19-
import { AutoClosingWithActionsModal as UiAutoClosingWithActionsModal } from '@ui/components/editor/panel/modals/AutoClosingWithActionsModal'
2019
import { EditCheckpointDescriptionModal as UiEditCheckpointDescriptionModal } from '@ui/components/editor/panel/modals/EditCheckpointDescriptionModal'
2120
import { use_panel } from './hooks/panel/use-panel'
2221
import { FileInPreview } from '@shared/types/file-in-preview'
@@ -139,8 +138,6 @@ export const Panel = () => {
139138
api_manager_progress_state,
140139
auto_closing_modal_data,
141140
set_auto_closing_modal_data,
142-
auto_closing_with_actions_modal_data,
143-
set_auto_closing_with_actions_modal_data,
144141
is_preview_ongoing_modal_visible,
145142
set_is_preview_ongoing_modal_visible,
146143
relevant_files_modal_data,
@@ -852,31 +849,6 @@ export const Panel = () => {
852849
</div>
853850
)}
854851

855-
{auto_closing_with_actions_modal_data && (
856-
<div className={styles.slot}>
857-
<UiAutoClosingWithActionsModal
858-
title={auto_closing_with_actions_modal_data.title}
859-
type={auto_closing_with_actions_modal_data.type}
860-
duration={3000}
861-
action_label={auto_closing_with_actions_modal_data.action_label}
862-
on_action={() => {
863-
post_message(vscode, {
864-
command: 'AUTO_CLOSING_WITH_ACTIONS_MODAL_RESPONSE',
865-
action: 'action'
866-
})
867-
set_auto_closing_with_actions_modal_data(undefined)
868-
}}
869-
on_close={() => {
870-
post_message(vscode, {
871-
command: 'AUTO_CLOSING_WITH_ACTIONS_MODAL_RESPONSE',
872-
action: 'close'
873-
})
874-
set_auto_closing_with_actions_modal_data(undefined)
875-
}}
876-
/>
877-
</div>
878-
)}
879-
880852
{checkpoint_to_edit && (
881853
<div className={styles.slot}>
882854
<UiEditCheckpointDescriptionModal

‎apps/editor/src/views/panel/frontend/hooks/use-modal-manager.ts‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,6 @@ export const use_modal_manager = () => {
3030
{ title: string; type: 'success' | 'warning' | 'error' } | undefined
3131
>()
3232

33-
const [
34-
auto_closing_with_actions_modal_data,
35-
set_auto_closing_with_actions_modal_data
36-
] = useState<
37-
| {
38-
title: string
39-
type: 'success' | 'warning' | 'error'
40-
action_label: string
41-
}
42-
| undefined
43-
>()
44-
4533
const [
4634
is_preview_ongoing_modal_visible,
4735
set_is_preview_ongoing_modal_visible
@@ -94,12 +82,6 @@ export const use_modal_manager = () => {
9482
set_is_preview_ongoing_modal_visible(true)
9583
} else if (message.command == 'SHOW_RELEVANT_FILES_MODAL') {
9684
set_relevant_files_modal_data({ files: message.files })
97-
} else if (message.command == 'SHOW_AUTO_CLOSING_WITH_ACTIONS_MODAL') {
98-
set_auto_closing_with_actions_modal_data({
99-
title: message.title,
100-
type: message.type,
101-
action_label: message.action_label
102-
})
10385
}
10486
}
10587

@@ -113,8 +95,6 @@ export const use_modal_manager = () => {
11395
api_manager_progress_state,
11496
auto_closing_modal_data,
11597
set_auto_closing_modal_data,
116-
auto_closing_with_actions_modal_data,
117-
set_auto_closing_with_actions_modal_data,
11898
is_preview_ongoing_modal_visible,
11999
set_is_preview_ongoing_modal_visible,
120100
relevant_files_modal_data,

‎apps/editor/src/views/panel/types/messages.ts‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -577,11 +577,6 @@ export interface RelevantFilesModalResponseMessage extends BaseMessage {
577577
files?: string[]
578578
}
579579

580-
export interface AutoClosingWithActionsModalResponseMessage extends BaseMessage {
581-
command: 'AUTO_CLOSING_WITH_ACTIONS_MODAL_RESPONSE'
582-
action: 'action' | 'close'
583-
}
584-
585580
export type FrontendMessage =
586581
| GetInstructionsMessage
587582
| SaveInstructionsMessage
@@ -676,7 +671,6 @@ export type FrontendMessage =
676671
| GetSetupProgressMessage
677672
| RequestReturnHomeMessage
678673
| RelevantFilesModalResponseMessage
679-
| AutoClosingWithActionsModalResponseMessage
680674

681675
// === FROM BACKEND TO FRONTEND ===
682676
export interface InstructionsMessage extends BaseMessage {
@@ -887,13 +881,6 @@ export interface ShowAutoClosingModalMessage extends BaseMessage {
887881
type: 'success' | 'warning' | 'error'
888882
}
889883

890-
export interface ShowAutoClosingWithActionsModalMessage extends BaseMessage {
891-
command: 'SHOW_AUTO_CLOSING_WITH_ACTIONS_MODAL'
892-
title: string
893-
type: 'success' | 'warning' | 'error'
894-
action_label: string
895-
}
896-
897884
export interface UpdateFileInPreviewMessage extends BaseMessage {
898885
command: 'UPDATE_FILE_IN_PREVIEW'
899886
file: FileInPreview
@@ -1003,4 +990,3 @@ export type BackendMessage =
1003990
| InsertSymbolAtCursorMessage
1004991
| ReturnHomeMessage
1005992
| ShowRelevantFilesModalMessage
1006-
| ShowAutoClosingWithActionsModalMessage

0 commit comments

Comments
 (0)