Skip to content

Commit 1a9a4f9

Browse files
committed
Exclude code at cursor responses from checkpoints and commit message tracking
- do we create checkpoint and touch CommitMessageDetails when processing 'code at cursor' response? should not └── apps └── editor └── src └── commands └── apply-response-command ├── apply-response-command.ts ├── handlers │ ├── diff-handler.ts │ ├── fast-replace-handler.ts │ ├── restore-preview-handler.ts │ ├── search-replace-handler.ts │ └── truncated-handler.ts ├── index.ts ├── response-processor.ts ├── types │ └── original-file-state.ts └── utils ├── file-checks.ts ├── file-operations.ts ├── preview │ ├── diff-utils.ts │ ├── file-preparer.ts │ ├── index.ts │ ├── preview.ts │ ├── temp-file-manager.ts │ ├── types.ts │ ├── virtual-document-provider.ts │ ├── vscode-ui.ts │ └── workspace-listener.ts ├── preview-handler.ts └── state-manager.ts
1 parent 73a60ac commit 1a9a4f9

2 files changed

Lines changed: 20 additions & 14 deletions

File tree

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ export const apply_response_command = (params: {
120120
(i) => i.type == 'intelligent-file-search-results'
121121
)
122122

123+
const is_code_at_cursor = response_items.some(
124+
(item) => item.type == 'code-at-cursor'
125+
)
126+
123127
if (resolve_fn && !is_intelligent_file_search_results) {
124128
const history = params.prompt_view_provider.response_history
125129

@@ -212,13 +216,10 @@ export const apply_response_command = (params: {
212216
const has_valid_blocks =
213217
(args?.files_with_content && args.files_with_content.length > 0) ||
214218
response_items.some(
215-
(item) =>
216-
item.type == 'file' ||
217-
item.type == 'diff' ||
218-
item.type == 'code-at-cursor'
219+
(item) => item.type == 'file' || item.type == 'diff'
219220
)
220221

221-
if (has_valid_blocks) {
222+
if (has_valid_blocks && !is_code_at_cursor) {
222223
params.prompt_view_provider.send_message({
223224
command: 'SHOW_PROGRESS',
224225
title: t('common.progress.preparing-preview')
@@ -405,7 +406,8 @@ export const apply_response_command = (params: {
405406
raw_instructions: args?.raw_instructions,
406407
created_at: created_at_for_preview,
407408
url: args?.url,
408-
recent_api_configuration: args?.recent_api_configuration
409+
recent_api_configuration: args?.recent_api_configuration,
410+
is_code_at_cursor
409411
})
410412

411413
if (changes_accepted) {

‎apps/editor/src/commands/apply-response-command/utils/preview-handler.ts‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const preview_handler = async (params: {
2727
created_at?: number
2828
url?: string
2929
recent_api_configuration?: RecentApiConfiguration
30+
is_code_at_cursor?: boolean
3031
}): Promise<boolean> => {
3132
let resolve_cleanup_promise: () => void
3233
ongoing_preview_cleanup_promise = new Promise((resolve) => {
@@ -154,14 +155,17 @@ export const preview_handler = async (params: {
154155
}
155156
}
156157

157-
for (const [workspace_root, files] of files_by_workspace.entries()) {
158-
CommitMessageDetails.add({
159-
extension_context: params.extension_context,
160-
workspace_root,
161-
prompt: params.raw_instructions,
162-
files,
163-
selected_files: selected_files_by_workspace.get(workspace_root) || []
164-
})
158+
if (!params.is_code_at_cursor) {
159+
for (const [workspace_root, files] of files_by_workspace.entries()) {
160+
CommitMessageDetails.add({
161+
extension_context: params.extension_context,
162+
workspace_root,
163+
prompt: params.raw_instructions,
164+
files,
165+
selected_files:
166+
selected_files_by_workspace.get(workspace_root) || []
167+
})
168+
}
165169
}
166170

167171
update_undo_button_state({

0 commit comments

Comments
 (0)