Skip to content

Commit 2949182

Browse files
committed
Remove customizable edit format instructions from settings and replace them with hardcoded constants
- remove the ability to edit 'edit formats' - as we recently removed support for custom edit formats, finish the work [Changes] ├── apps │ └── editor │ ├── package.json │ └── src │ └── views │ ├── prompt │ │ └── backend │ │ ├── message-handlers │ │ │ ├── handle-autofill.ts │ │ │ ├── handle-copy-prompt.ts │ │ │ ├── handle-get-edit-format-instructions.ts │ │ │ ├── handle-make-api-call.ts │ │ │ └── handle-preview-web-configuration.ts │ │ └── prompt-view-provider.ts │ └── settings │ ├── backend │ │ ├── message-handlers │ │ │ ├── handle-get-synchronize-edit-format-between-modes.ts │ │ │ └── handle-update-synchronize-edit-format-between-modes.ts │ │ └── settings-view-provider.ts │ ├── frontend │ │ ├── Home │ │ │ ├── Home.tsx │ │ │ └── sections │ │ │ └── GeneralSection.tsx │ │ └── hooks │ │ └── use-settings.ts │ └── types │ └── messages.ts └── docs └── chatbot-initialization.mdx
1 parent 6ae4e48 commit 2949182

16 files changed

Lines changed: 9 additions & 440 deletions

‎apps/editor/package.json‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,22 +1017,6 @@
10171017
"type": "string"
10181018
}
10191019
},
1020-
"codeWebChat.editFormatInstructionsWhole": {
1021-
"type": "string",
1022-
"scope": "resource"
1023-
},
1024-
"codeWebChat.editFormatInstructionsTruncated": {
1025-
"type": "string",
1026-
"scope": "resource"
1027-
},
1028-
"codeWebChat.editFormatInstructionsSearchReplace": {
1029-
"type": "string",
1030-
"scope": "resource"
1031-
},
1032-
"codeWebChat.editFormatInstructionsDiff": {
1033-
"type": "string",
1034-
"scope": "resource"
1035-
},
10361020
"codeWebChat.findRelevantFilesInstructions": {
10371021
"type": "string",
10381022
"scope": "resource"

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,21 +166,12 @@ export const handle_autofill = async (params: {
166166
let formatted_system_instructions = ''
167167
let user_instructions = processed_instructions
168168
if (params.prompt_view_provider.web_prompt_type == 'edit-files') {
169-
const config = vscode.workspace.getConfiguration('codeWebChat')
170-
const instructions_key = {
171-
whole: 'editFormatInstructionsWhole',
172-
truncated: 'editFormatInstructionsTruncated',
173-
'search-replace': 'editFormatInstructionsSearchReplace',
174-
diff: 'editFormatInstructionsDiff'
175-
}[params.prompt_view_provider.edit_format]
176-
const default_instructions = {
169+
const edit_format_instructions = {
177170
whole: EDIT_FORMAT_INSTRUCTIONS_WHOLE,
178171
truncated: EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
179172
'search-replace': EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE,
180173
diff: EDIT_FORMAT_INSTRUCTIONS_DIFF
181174
}[params.prompt_view_provider.edit_format]
182-
const edit_format_instructions =
183-
config.get<string>(instructions_key) || default_instructions
184175
if (edit_format_instructions) {
185176
formatted_system_instructions = `# Output formatting\n\n${edit_format_instructions}`
186177
}

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,21 +123,12 @@ export const handle_copy_prompt = async (params: {
123123

124124
if (params.prompt_view_provider.prompt_type == 'edit-files') {
125125
const edit_format = params.prompt_view_provider.edit_format
126-
const config = vscode.workspace.getConfiguration('codeWebChat')
127-
const instructions_key = {
128-
whole: 'editFormatInstructionsWhole',
129-
truncated: 'editFormatInstructionsTruncated',
130-
'search-replace': 'editFormatInstructionsSearchReplace',
131-
diff: 'editFormatInstructionsDiff'
132-
}[edit_format]
133-
const default_instructions = {
126+
const edit_format_instructions = {
134127
whole: EDIT_FORMAT_INSTRUCTIONS_WHOLE,
135128
truncated: EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
136129
'search-replace': EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE,
137130
diff: EDIT_FORMAT_INSTRUCTIONS_DIFF
138131
}[edit_format]
139-
const edit_format_instructions =
140-
config.get<string>(instructions_key) || default_instructions
141132
if (edit_format_instructions) {
142133
formatted_system_instructions = `# Output formatting\n\n${edit_format_instructions}`
143134
}

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

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { PromptViewProvider } from '@/views/prompt/backend/prompt-view-provider'
2-
import * as vscode from 'vscode'
32
import { EditFormat } from '@shared/types/edit-format'
43
import {
54
EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE,
@@ -11,19 +10,11 @@ import {
1110
export const handle_get_edit_format_instructions = (
1211
prompt_view_provider: PromptViewProvider
1312
) => {
14-
const config = vscode.workspace.getConfiguration('codeWebChat')
1513
const instructions: Record<EditFormat, string> = {
16-
whole:
17-
config.get('editFormatInstructionsWhole') ||
18-
EDIT_FORMAT_INSTRUCTIONS_WHOLE,
19-
truncated:
20-
config.get('editFormatInstructionsTruncated') ||
21-
EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
22-
'search-replace':
23-
config.get('editFormatInstructionsSearchReplace') ||
24-
EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE,
25-
diff:
26-
config.get('editFormatInstructionsDiff') || EDIT_FORMAT_INSTRUCTIONS_DIFF
14+
whole: EDIT_FORMAT_INSTRUCTIONS_WHOLE,
15+
truncated: EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
16+
'search-replace': EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE,
17+
diff: EDIT_FORMAT_INSTRUCTIONS_DIFF
2718
}
2819
prompt_view_provider.send_message({
2920
command: 'EDIT_FORMAT_INSTRUCTIONS',

‎apps/editor/src/views/prompt/backend/message-handlers/handle-make-api-call.ts‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -298,21 +298,12 @@ export const handle_make_api_call = async (
298298

299299
if (prompt_type == 'edit-files') {
300300
edit_format = prompt_view_provider.edit_format
301-
const config = vscode.workspace.getConfiguration('codeWebChat')
302-
const instructions_key = {
303-
whole: 'editFormatInstructionsWhole',
304-
truncated: 'editFormatInstructionsTruncated',
305-
diff: 'editFormatInstructionsDiff',
306-
'search-replace': 'editFormatInstructionsSearchReplace'
307-
}[edit_format]
308-
const default_instructions = {
301+
const edit_format_instructions = {
309302
whole: EDIT_FORMAT_INSTRUCTIONS_WHOLE,
310303
truncated: EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
311304
diff: EDIT_FORMAT_INSTRUCTIONS_DIFF,
312305
'search-replace': EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE
313306
}[edit_format]
314-
const edit_format_instructions =
315-
config.get<string>(instructions_key) || default_instructions
316307

317308
let formatted_system_instructions = ''
318309
if (edit_format_instructions) {

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,21 +114,12 @@ export const handle_preview_web_configuration = async (
114114
let formatted_system_instructions = ''
115115
let user_instructions = processed_instructions
116116
if (prompt_view_provider.web_prompt_type == 'edit-files') {
117-
const config = vscode.workspace.getConfiguration('codeWebChat')
118-
const instructions_key = {
119-
whole: 'editFormatInstructionsWhole',
120-
truncated: 'editFormatInstructionsTruncated',
121-
'search-replace': 'editFormatInstructionsSearchReplace',
122-
diff: 'editFormatInstructionsDiff'
123-
}[prompt_view_provider.edit_format]
124-
const default_instructions = {
117+
const edit_format_instructions = {
125118
whole: EDIT_FORMAT_INSTRUCTIONS_WHOLE,
126119
truncated: EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
127120
'search-replace': EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE,
128121
diff: EDIT_FORMAT_INSTRUCTIONS_DIFF
129122
}[prompt_view_provider.edit_format]
130-
const edit_format_instructions =
131-
config.get<string>(instructions_key) || default_instructions
132123
if (edit_format_instructions) {
133124
formatted_system_instructions = `# Output formatting\n\n${edit_format_instructions}`
134125
}

‎apps/editor/src/views/prompt/backend/prompt-view-provider.ts‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -457,18 +457,6 @@ export class PromptViewProvider implements vscode.WebviewViewProvider {
457457
this.send_web_configurations_to_webview(this.webview_view.webview)
458458
}
459459

460-
if (
461-
event.affectsConfiguration(
462-
'codeWebChat.editFormatInstructionsWhole'
463-
) ||
464-
event.affectsConfiguration(
465-
'codeWebChat.editFormatInstructionsTruncated'
466-
) ||
467-
event.affectsConfiguration('codeWebChat.editFormatInstructionsDiff')
468-
) {
469-
handle_get_edit_format_instructions(this)
470-
}
471-
472460
if (
473461
event.affectsConfiguration('codeWebChat.contextSizeWarningThreshold')
474462
) {

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

Lines changed: 0 additions & 32 deletions
This file was deleted.

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

Lines changed: 0 additions & 49 deletions
This file was deleted.

‎apps/editor/src/views/settings/backend/message-handlers/index.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ export * from './handle-set-default-api-configuration'
99
export * from './handle-select-default-api-configuration'
1010
export * from './handle-get-edit-files-system-instructions'
1111
export * from './handle-update-edit-files-system-instructions'
12-
export * from './handle-get-edit-format-instructions'
13-
export * from './handle-update-edit-format-instructions'
1412
export * from './handle-get-commit-message-instructions'
1513
export * from './handle-update-commit-message-instructions'
1614
export * from './handle-get-attach-ascii-tree-of-context'

0 commit comments

Comments
 (0)