Skip to content

Commit 8163f41

Browse files
committed
Replace "compared" edit format with "before-after" across all components and configurations
1 parent 6722cc9 commit 8163f41

14 files changed

Lines changed: 45 additions & 43 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export type EditFormat = 'whole' | 'truncated' | 'compared' | 'diff'
1+
export type EditFormat = 'whole' | 'truncated' | 'before-after' | 'diff'

‎packages/ui/src/components/editor/panel/PromptField/PromptField.stories.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export const WithEditFormatSelector = () => {
206206
edit_format_instructions={{
207207
whole: 'Use the whole...',
208208
truncated: 'Use truncated...',
209-
compared: 'Use compared...',
209+
'before-after': 'Use before and after...',
210210
diff: 'Use diff...'
211211
}}
212212
context_file_paths={[]}

‎packages/ui/src/components/editor/panel/PromptField/PromptField.tsx‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const Tooltip: React.FC<{
4141
</div>
4242
)
4343

44-
export type EditFormat = 'whole' | 'truncated' | 'diff' | 'compared'
44+
export type EditFormat = 'whole' | 'truncated' | 'diff' | 'before-after'
4545

4646
export type PromptFieldProps = {
4747
value: string
@@ -104,8 +104,8 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
104104
case 'KeyT':
105105
format = 'truncated'
106106
break
107-
case 'KeyC':
108-
format = 'compared'
107+
case 'KeyB':
108+
format = 'before-after'
109109
break
110110
case 'KeyD':
111111
format = 'diff'
@@ -311,7 +311,7 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
311311
return {
312312
whole: `(${modifier}W)`,
313313
truncated: `(${modifier}T)`,
314-
compared: `(${modifier}C)`,
314+
'before-after': `(${modifier}B)`,
315315
diff: `(${modifier}D)`
316316
}
317317
}, [is_mac])
@@ -469,11 +469,13 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
469469
>
470470
{props.show_edit_format_selector && (
471471
<div className={styles['footer__right__edit-format']}>
472-
{(['whole', 'truncated', 'compared', 'diff'] as const).map(
472+
{(['whole', 'truncated', 'before-after', 'diff'] as const).map(
473473
(format) => {
474474
const button_text = is_narrow_viewport
475475
? format.charAt(0).toUpperCase()
476-
: format
476+
: format == 'before-after'
477+
? 'before/after'
478+
: format
477479
const is_selected = props.edit_format == format
478480
const should_underline = is_alt_pressed && !is_selected
479481

‎packages/vscode/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@
597597
"type": "string",
598598
"scope": "resource"
599599
},
600-
"codeWebChat.editFormatInstructionsCompared": {
600+
"codeWebChat.editFormatInstructionsBeforeAfter": {
601601
"type": "string",
602602
"scope": "resource"
603603
},

‎packages/vscode/src/constants/edit-format-instructions.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Updated the greeting text.
4040
print(GREETING)
4141
\`\`\``
4242

43-
export const EDIT_FORMAT_INSTRUCTIONS_COMPARED = `${intro}, followed by a markdown code block showing the original and updated code snippets with Git-style merge conflict markers. Example:
43+
export const EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER = `${intro}, followed by a markdown code block showing the original and updated code snippets with Git-style merge conflict markers. Example:
4444
Updated the greeting text.
4545
4646
### Updated file: \`src/hello.py\`

‎packages/vscode/src/views/panel/backend/message-handlers/handle-copy-prompt.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import { apply_preset_affixes_to_instruction } from '@/utils/apply-preset-affixe
1313
import { MODE } from '@/views/panel/types/main-view-mode'
1414
import { dictionary } from '@shared/constants/dictionary'
1515
import {
16-
EDIT_FORMAT_INSTRUCTIONS_COMPARED,
17-
EDIT_FORMAT_INSTRUCTIONS_DIFF,
16+
EDIT_FORMAT_INSTRUCTIONS_WHOLE,
1817
EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
19-
EDIT_FORMAT_INSTRUCTIONS_WHOLE
18+
EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER,
19+
EDIT_FORMAT_INSTRUCTIONS_DIFF
2020
} from '@/constants/edit-format-instructions'
2121

2222
export const handle_copy_prompt = async (params: {
@@ -173,14 +173,14 @@ export const handle_copy_prompt = async (params: {
173173
const instructions_key = {
174174
whole: 'editFormatInstructionsWhole',
175175
truncated: 'editFormatInstructionsTruncated',
176-
compared: 'editFormatInstructionsCompared',
176+
'before-after': 'editFormatInstructionsBeforeAfter',
177177
diff: 'editFormatInstructionsDiff'
178178
}[edit_format]
179179
const default_instructions = {
180180
whole: EDIT_FORMAT_INSTRUCTIONS_WHOLE,
181181
truncated: EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
182-
diff: EDIT_FORMAT_INSTRUCTIONS_DIFF,
183-
compared: EDIT_FORMAT_INSTRUCTIONS_COMPARED
182+
'before-after': EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER,
183+
diff: EDIT_FORMAT_INSTRUCTIONS_DIFF
184184
}[edit_format]
185185
const edit_format_instructions =
186186
config.get<string>(instructions_key) || default_instructions

‎packages/vscode/src/views/panel/backend/message-handlers/handle-edit-context.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { dictionary } from '@shared/constants/dictionary'
2828
import {
2929
EDIT_FORMAT_INSTRUCTIONS_WHOLE,
3030
EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
31-
EDIT_FORMAT_INSTRUCTIONS_COMPARED,
31+
EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER,
3232
EDIT_FORMAT_INSTRUCTIONS_DIFF
3333
} from '@/constants/edit-format-instructions'
3434

@@ -370,13 +370,13 @@ const perform_context_editing = async (params: {
370370
whole: 'editFormatInstructionsWhole',
371371
truncated: 'editFormatInstructionsTruncated',
372372
diff: 'editFormatInstructionsDiff',
373-
compared: 'editFormatInstructionsCompared'
373+
'before-after': 'editFormatInstructionsBeforeAfter'
374374
}[edit_format]
375375
const default_instructions = {
376376
whole: EDIT_FORMAT_INSTRUCTIONS_WHOLE,
377377
truncated: EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
378378
diff: EDIT_FORMAT_INSTRUCTIONS_DIFF,
379-
compared: EDIT_FORMAT_INSTRUCTIONS_COMPARED
379+
'before-after': EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER
380380
}[edit_format]
381381
const edit_format_instructions =
382382
config.get<string>(instructions_key) || default_instructions

‎packages/vscode/src/views/panel/backend/message-handlers/handle-get-edit-format-instructions.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { PanelProvider } from '@/views/panel/backend/panel-provider'
22
import * as vscode from 'vscode'
33
import { EditFormat } from '@shared/types/edit-format'
44
import {
5-
EDIT_FORMAT_INSTRUCTIONS_COMPARED,
5+
EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER,
66
EDIT_FORMAT_INSTRUCTIONS_DIFF,
77
EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
88
EDIT_FORMAT_INSTRUCTIONS_WHOLE
@@ -19,9 +19,9 @@ export const handle_get_edit_format_instructions = (
1919
truncated:
2020
config.get('editFormatInstructionsTruncated') ||
2121
EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
22-
compared:
23-
config.get('editFormatInstructionsCompared') ||
24-
EDIT_FORMAT_INSTRUCTIONS_COMPARED,
22+
'before-after':
23+
config.get('editFormatInstructionsBeforeAfter') ||
24+
EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER,
2525
diff:
2626
config.get('editFormatInstructionsDiff') || EDIT_FORMAT_INSTRUCTIONS_DIFF
2727
}

‎packages/vscode/src/views/panel/backend/message-handlers/handle-preview-preset.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { dictionary } from '@shared/constants/dictionary'
1616
import {
1717
EDIT_FORMAT_INSTRUCTIONS_WHOLE,
1818
EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
19-
EDIT_FORMAT_INSTRUCTIONS_COMPARED,
19+
EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER,
2020
EDIT_FORMAT_INSTRUCTIONS_DIFF
2121
} from '@/constants/edit-format-instructions'
2222

@@ -160,13 +160,13 @@ export const handle_preview_preset = async (
160160
const instructions_key = {
161161
whole: 'editFormatInstructionsWhole',
162162
truncated: 'editFormatInstructionsTruncated',
163-
compared: 'editFormatInstructionsCompared',
163+
'before-after': 'editFormatInstructionsBeforeAfter',
164164
diff: 'editFormatInstructionsDiff'
165165
}[panel_provider.chat_edit_format]
166166
const default_instructions = {
167167
whole: EDIT_FORMAT_INSTRUCTIONS_WHOLE,
168168
truncated: EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
169-
compared: EDIT_FORMAT_INSTRUCTIONS_COMPARED,
169+
'before-after': EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER,
170170
diff: EDIT_FORMAT_INSTRUCTIONS_DIFF
171171
}[panel_provider.chat_edit_format]
172172
const edit_format_instructions =

‎packages/vscode/src/views/panel/backend/message-handlers/handle-send-prompt.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { dictionary } from '@shared/constants/dictionary'
2323
import {
2424
EDIT_FORMAT_INSTRUCTIONS_WHOLE,
2525
EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
26-
EDIT_FORMAT_INSTRUCTIONS_COMPARED,
26+
EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER,
2727
EDIT_FORMAT_INSTRUCTIONS_DIFF
2828
} from '@/constants/edit-format-instructions'
2929

@@ -247,13 +247,13 @@ export const handle_send_prompt = async (params: {
247247
const instructions_key = {
248248
whole: 'editFormatInstructionsWhole',
249249
truncated: 'editFormatInstructionsTruncated',
250-
compared: 'editFormatInstructionsCompared',
250+
'before-after': 'editFormatInstructionsBeforeAfter',
251251
diff: 'editFormatInstructionsDiff'
252252
}[params.panel_provider.chat_edit_format]
253253
const default_instructions = {
254254
whole: EDIT_FORMAT_INSTRUCTIONS_WHOLE,
255255
truncated: EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
256-
compared: EDIT_FORMAT_INSTRUCTIONS_COMPARED,
256+
'before-after': EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER,
257257
diff: EDIT_FORMAT_INSTRUCTIONS_DIFF
258258
}[params.panel_provider.chat_edit_format]
259259
const edit_format_instructions =

0 commit comments

Comments
 (0)