Skip to content

Commit d043d13

Browse files
committed
Rename the before-after edit format instructions and configuration to search-replace
- rename 'before after' to 'search replace'
1 parent be6f844 commit d043d13

16 files changed

Lines changed: 99 additions & 98 deletions

File tree

‎apps/editor/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@
856856
"type": "string",
857857
"scope": "resource"
858858
},
859-
"codeWebChat.editFormatInstructionsBeforeAfter": {
859+
"codeWebChat.editFormatInstructionsSearchReplace": {
860860
"type": "string",
861861
"scope": "resource"
862862
},

‎apps/editor/src/constants/edit-format-instructions.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def subtract(a, b):
115115
116116
### Renamed file: \`src/examples/math_utils.py\` (old) \`src/examples/calculator.py\` (new)`
117117

118-
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 syntax. Example:
118+
export const EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE = `${intro}, followed by a markdown code block showing the original and updated code snippets with Git-style merge conflict syntax. Example:
119119
Changed greeting to wishes.
120120
121121
### Updated file: \`src/examples/hello.py\`

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { dictionary } from '@shared/constants/dictionary'
1111
import {
1212
EDIT_FORMAT_INSTRUCTIONS_WHOLE,
1313
EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
14-
EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER,
14+
EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE,
1515
EDIT_FORMAT_INSTRUCTIONS_DIFF
1616
} from '@/constants/edit-format-instructions'
1717
import { FIND_RELEVANT_FILES_SHRINK_SOURCE_CODE_STATE_KEY } from '@/constants/state-keys'
@@ -126,13 +126,13 @@ export const handle_copy_prompt = async (params: {
126126
const instructions_key = {
127127
whole: 'editFormatInstructionsWhole',
128128
truncated: 'editFormatInstructionsTruncated',
129-
'before-after': 'editFormatInstructionsBeforeAfter',
129+
'search-replace': 'editFormatInstructionsSearchReplace',
130130
diff: 'editFormatInstructionsDiff'
131131
}[edit_format]
132132
const default_instructions = {
133133
whole: EDIT_FORMAT_INSTRUCTIONS_WHOLE,
134134
truncated: EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
135-
'before-after': EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER,
135+
'search-replace': EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE,
136136
diff: EDIT_FORMAT_INSTRUCTIONS_DIFF
137137
}[edit_format]
138138
const edit_format_instructions =

‎apps/editor/src/views/panel/backend/message-handlers/handle-edit-context.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { dictionary } from '@shared/constants/dictionary'
2020
import {
2121
EDIT_FORMAT_INSTRUCTIONS_WHOLE,
2222
EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
23-
EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER,
23+
EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE,
2424
EDIT_FORMAT_INSTRUCTIONS_DIFF
2525
} from '@/constants/edit-format-instructions'
2626
import { default_system_instructions } from '@shared/constants/default-system-instructions'
@@ -357,13 +357,13 @@ export const handle_edit_context = async (
357357
whole: 'editFormatInstructionsWhole',
358358
truncated: 'editFormatInstructionsTruncated',
359359
diff: 'editFormatInstructionsDiff',
360-
'before-after': 'editFormatInstructionsBeforeAfter'
360+
'search-replace': 'editFormatInstructionsSearchReplace'
361361
}[edit_format]
362362
const default_instructions = {
363363
whole: EDIT_FORMAT_INSTRUCTIONS_WHOLE,
364364
truncated: EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
365365
diff: EDIT_FORMAT_INSTRUCTIONS_DIFF,
366-
'before-after': EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER
366+
'search-replace': EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE
367367
}[edit_format]
368368
const edit_format_instructions =
369369
config.get<string>(instructions_key) || default_instructions

‎apps/editor/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_BEFORE_AFTER,
5+
EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE,
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-
'before-after':
23-
config.get('editFormatInstructionsBeforeAfter') ||
24-
EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER,
22+
'search-replace':
23+
config.get('editFormatInstructionsSearchReplace') ||
24+
EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE,
2525
diff:
2626
config.get('editFormatInstructionsDiff') || EDIT_FORMAT_INSTRUCTIONS_DIFF
2727
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { dictionary } from '@shared/constants/dictionary'
77
import {
88
EDIT_FORMAT_INSTRUCTIONS_WHOLE,
99
EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
10-
EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER,
10+
EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE,
1111
EDIT_FORMAT_INSTRUCTIONS_DIFF
1212
} from '@/constants/edit-format-instructions'
1313
import { replace_symbols } from '@/views/panel/backend/utils/symbols/replace-symbols'
@@ -87,13 +87,13 @@ export const handle_preview_web_configuration = async (
8787
const instructions_key = {
8888
whole: 'editFormatInstructionsWhole',
8989
truncated: 'editFormatInstructionsTruncated',
90-
'before-after': 'editFormatInstructionsBeforeAfter',
90+
'search-replace': 'editFormatInstructionsSearchReplace',
9191
diff: 'editFormatInstructionsDiff'
9292
}[panel_provider.chat_edit_format]
9393
const default_instructions = {
9494
whole: EDIT_FORMAT_INSTRUCTIONS_WHOLE,
9595
truncated: EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
96-
'before-after': EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER,
96+
'search-replace': EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE,
9797
diff: EDIT_FORMAT_INSTRUCTIONS_DIFF
9898
}[panel_provider.chat_edit_format]
9999
const edit_format_instructions =

‎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
@@ -18,7 +18,7 @@ import { dictionary } from '@shared/constants/dictionary'
1818
import {
1919
EDIT_FORMAT_INSTRUCTIONS_WHOLE,
2020
EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
21-
EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER,
21+
EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE,
2222
EDIT_FORMAT_INSTRUCTIONS_DIFF
2323
} from '@/constants/edit-format-instructions'
2424
import { handle_update_last_used_web_configuration_or_group } from './handle-update-last-used-web-configuration-or-group'
@@ -163,13 +163,13 @@ export const handle_send_to_browser = async (params: {
163163
const instructions_key = {
164164
whole: 'editFormatInstructionsWhole',
165165
truncated: 'editFormatInstructionsTruncated',
166-
'before-after': 'editFormatInstructionsBeforeAfter',
166+
'search-replace': 'editFormatInstructionsSearchReplace',
167167
diff: 'editFormatInstructionsDiff'
168168
}[params.panel_provider.chat_edit_format]
169169
const default_instructions = {
170170
whole: EDIT_FORMAT_INSTRUCTIONS_WHOLE,
171171
truncated: EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
172-
'before-after': EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER,
172+
'search-replace': EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE,
173173
diff: EDIT_FORMAT_INSTRUCTIONS_DIFF
174174
}[params.panel_provider.chat_edit_format]
175175
const edit_format_instructions =

‎apps/editor/src/views/settings/backend/message-handlers/handle-get-edit-format-instructions.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as vscode from 'vscode'
22
import { SettingsProvider } from '@/views/settings/backend/settings-provider'
33
import {
4-
EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER,
4+
EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE,
55
EDIT_FORMAT_INSTRUCTIONS_DIFF,
66
EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
77
EDIT_FORMAT_INSTRUCTIONS_WHOLE
@@ -21,9 +21,9 @@ export const handle_get_edit_format_instructions = async (
2121
diff:
2222
config.get('editFormatInstructionsDiff', '') ||
2323
EDIT_FORMAT_INSTRUCTIONS_DIFF,
24-
before_after:
25-
config.get('editFormatInstructionsBeforeAfter', '') ||
26-
EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER
24+
search_replace:
25+
config.get('editFormatInstructionsSearchReplace', '') ||
26+
EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE
2727
}
2828
provider.postMessage({
2929
command: 'EDIT_FORMAT_INSTRUCTIONS',

‎apps/editor/src/views/settings/backend/message-handlers/handle-update-edit-format-instructions.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as vscode from 'vscode'
22
import { UpdateEditFormatInstructionsMessage } from '@/views/settings/types/messages'
33
import {
4-
EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER,
4+
EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE,
55
EDIT_FORMAT_INSTRUCTIONS_DIFF,
66
EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
77
EDIT_FORMAT_INSTRUCTIONS_WHOLE
@@ -29,12 +29,12 @@ export const handle_update_edit_format_instructions = async (
2929
vscode.ConfigurationTarget.Global
3030
),
3131
config.update(
32-
'editFormatInstructionsBeforeAfter',
33-
message.instructions.before_after == '' ||
34-
message.instructions.before_after ==
35-
EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER
32+
'editFormatInstructionsSearchReplace',
33+
message.instructions.search_replace == '' ||
34+
message.instructions.search_replace ==
35+
EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE
3636
? undefined
37-
: message.instructions.before_after,
37+
: message.instructions.search_replace,
3838
vscode.ConfigurationTarget.Global
3939
),
4040
config.update(

‎apps/editor/src/views/settings/frontend/Home/sections/GeneralSection.tsx‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
DEFAULT_CONTEXT_SIZE_WARNING_THRESHOLD
1414
} from '@/constants/values'
1515
import {
16-
EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER,
16+
EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE,
1717
EDIT_FORMAT_INSTRUCTIONS_DIFF,
1818
EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
1919
EDIT_FORMAT_INSTRUCTIONS_WHOLE
@@ -66,13 +66,13 @@ export const GeneralSection = forwardRef<HTMLDivElement, Props>(
6666
const [instructions, set_instructions] = useState<EditFormatInstructions>({
6767
whole: '',
6868
truncated: '',
69-
before_after: '',
69+
search_replace: '',
7070
diff: ''
7171
})
7272
const [instructions_visibility, set_instructions_visibility] = useState({
7373
whole: false,
7474
truncated: false,
75-
before_after: false,
75+
search_replace: false,
7676
diff: false
7777
})
7878

@@ -169,12 +169,12 @@ export const GeneralSection = forwardRef<HTMLDivElement, Props>(
169169
EDIT_FORMAT_INSTRUCTIONS_TRUNCATED
170170
? EDIT_FORMAT_INSTRUCTIONS_TRUNCATED
171171
: prev.truncated,
172-
before_after:
173-
prev.before_after == '' &&
174-
props.edit_format_instructions.before_after ==
175-
EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER
176-
? EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER
177-
: prev.before_after,
172+
search_replace:
173+
prev.search_replace == '' &&
174+
props.edit_format_instructions.search_replace ==
175+
EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE
176+
? EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE
177+
: prev.search_replace,
178178
diff:
179179
prev.diff == '' &&
180180
props.edit_format_instructions.diff == EDIT_FORMAT_INSTRUCTIONS_DIFF
@@ -390,31 +390,31 @@ export const GeneralSection = forwardRef<HTMLDivElement, Props>(
390390
/>
391391

392392
<UiItem
393-
title={t('general.edit-format.before-after.title')}
394-
description={t('general.edit-format.before-after.description')}
393+
title={t('general.edit-format.search-replace.title')}
394+
description={t('general.edit-format.search-replace.description')}
395395
slot_right={
396396
<UiTextButton
397397
on_click={() =>
398398
set_instructions_visibility((prev) => ({
399399
...prev,
400-
before_after: !prev.before_after
400+
search_replace: !prev.search_replace
401401
}))
402402
}
403403
>
404-
{instructions_visibility.before_after
404+
{instructions_visibility.search_replace
405405
? t('general.edit-format.hide')
406406
: t('general.edit-format.show')}
407407
</UiTextButton>
408408
}
409409
slot_below={
410-
instructions_visibility.before_after && (
410+
instructions_visibility.search_replace && (
411411
<UiTextarea
412-
value={instructions.before_after}
412+
value={instructions.search_replace}
413413
min_rows={3}
414414
on_change={(value) =>
415415
set_instructions((prev) => ({
416416
...prev,
417-
before_after: value
417+
search_replace: value
418418
}))
419419
}
420420
on_blur={handle_instructions_blur}

0 commit comments

Comments
 (0)