Skip to content

Commit 628e13e

Browse files
committed
Update all context placeholder symbols to use parentheses syntax instead of colons
1 parent 514a711 commit 628e13e

22 files changed

Lines changed: 597 additions & 487 deletions

‎apps/editor/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,12 +454,12 @@
454454
"group": "navigation@5"
455455
},
456456
{
457-
"command": "codeWebChat.newFolder",
457+
"command": "codeWebChat.newFile",
458458
"when": "view == codeWebChatViewWorkspace",
459459
"group": "navigation@6"
460460
},
461461
{
462-
"command": "codeWebChat.newFile",
462+
"command": "codeWebChat.newFolder",
463463
"when": "view == codeWebChatViewWorkspace",
464464
"group": "navigation@7"
465465
},

‎apps/editor/src/utils/replace-saved-context-placeholder.ts‎

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

‎apps/editor/src/views/panel/backend/message-handlers/handle-code-completion.ts‎

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ import { CodeCompletionMessage } from '@/views/panel/types/messages'
1818
import { apply_reasoning_effort } from '@/utils/apply-reasoning-effort'
1919
import { dictionary } from '@shared/constants/dictionary'
2020
import { randomUUID } from 'crypto'
21-
import { replace_selection_placeholder } from '../utils/replace-selection-symbol'
21+
import { replace_selection_symbol } from '../utils/replace-selection-symbol'
2222
import {
2323
replace_changes_symbol,
2424
replace_commit_symbol,
2525
replace_context_at_commit_symbol
2626
} from '../utils/replace-git-symbols'
27-
import { replace_saved_context_placeholder } from '@/utils/replace-saved-context-placeholder'
27+
import { replace_saved_context_symbol } from '@/views/panel/backend/utils/replace-saved-context-symbol'
2828
import { replace_skill_symbol } from '../utils/replace-skill-symbol'
2929

3030
const get_code_completion_config = async (
@@ -356,46 +356,51 @@ export const handle_code_completion = async (
356356
let skill_definitions = ''
357357

358358
if (processed_completion_instructions.includes('#Selection')) {
359-
processed_completion_instructions = replace_selection_placeholder(
359+
processed_completion_instructions = replace_selection_symbol(
360360
processed_completion_instructions
361361
)
362362
}
363363

364-
if (processed_completion_instructions.includes('#Changes:')) {
365-
processed_completion_instructions = await replace_changes_symbol({
364+
if (processed_completion_instructions.includes('#Changes(')) {
365+
const result = await replace_changes_symbol({
366366
instruction: processed_completion_instructions
367367
})
368+
processed_completion_instructions = result.instruction
369+
skill_definitions += result.changes_definitions
368370
}
369371

370-
if (processed_completion_instructions.includes('#Commit:')) {
371-
processed_completion_instructions = await replace_commit_symbol({
372+
if (processed_completion_instructions.includes('#Commit(')) {
373+
const result = await replace_commit_symbol({
372374
instruction: processed_completion_instructions
373375
})
376+
processed_completion_instructions = result.instruction
377+
skill_definitions += result.commit_definitions
374378
}
375379

376-
if (processed_completion_instructions.includes('#ContextAtCommit:')) {
380+
if (processed_completion_instructions.includes('#ContextAtCommit(')) {
377381
processed_completion_instructions =
378382
await replace_context_at_commit_symbol({
379383
instruction: processed_completion_instructions,
380384
workspace_provider: panel_provider.workspace_provider
381385
})
382386
}
383387

384-
if (processed_completion_instructions.includes('#SavedContext:')) {
385-
processed_completion_instructions =
386-
await replace_saved_context_placeholder({
387-
instruction: processed_completion_instructions,
388-
context: panel_provider.context,
389-
workspace_provider: panel_provider.workspace_provider
390-
})
388+
if (processed_completion_instructions.includes('#SavedContext(')) {
389+
const result = await replace_saved_context_symbol({
390+
instruction: processed_completion_instructions,
391+
context: panel_provider.context,
392+
workspace_provider: panel_provider.workspace_provider
393+
})
394+
processed_completion_instructions = result.instruction
395+
skill_definitions += result.context_definitions
391396
}
392397

393-
if (processed_completion_instructions.includes('#Skill:')) {
398+
if (processed_completion_instructions.includes('#Skill(')) {
394399
const result = await replace_skill_symbol({
395400
instruction: processed_completion_instructions
396401
})
397402
processed_completion_instructions = result.instruction
398-
skill_definitions = result.skill_definitions
403+
skill_definitions += result.skill_definitions
399404
}
400405

401406
const files_collector = new FilesCollector(

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

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { PanelProvider } from '@/views/panel/backend/panel-provider'
22
import * as vscode from 'vscode'
33
import { FilesCollector } from '@/utils/files-collector'
4-
import { replace_selection_placeholder } from '@/views/panel/backend/utils/replace-selection-symbol'
4+
import { replace_selection_symbol } from '@/views/panel/backend/utils/replace-selection-symbol'
55
import {
66
replace_changes_symbol,
77
replace_commit_symbol,
88
replace_context_at_commit_symbol
99
} from '@/views/panel/backend/utils/replace-git-symbols'
10-
import { replace_saved_context_placeholder } from '@/utils/replace-saved-context-placeholder'
10+
import { replace_saved_context_symbol } from '@/views/panel/backend/utils/replace-saved-context-symbol'
1111
import { replace_skill_symbol } from '@/views/panel/backend/utils/replace-skill-symbol'
1212
import {
1313
code_completion_instructions_for_panel,
@@ -93,46 +93,51 @@ export const handle_copy_prompt = async (params: {
9393
let skill_definitions = ''
9494

9595
if (processed_completion_instructions.includes('#Selection')) {
96-
processed_completion_instructions = replace_selection_placeholder(
96+
processed_completion_instructions = replace_selection_symbol(
9797
processed_completion_instructions
9898
)
9999
}
100100

101-
if (processed_completion_instructions.includes('#Changes:')) {
102-
processed_completion_instructions = await replace_changes_symbol({
101+
if (processed_completion_instructions.includes('#Changes(')) {
102+
const result = await replace_changes_symbol({
103103
instruction: processed_completion_instructions
104104
})
105+
processed_completion_instructions = result.instruction
106+
skill_definitions += result.changes_definitions
105107
}
106108

107-
if (processed_completion_instructions.includes('#Commit:')) {
108-
processed_completion_instructions = await replace_commit_symbol({
109+
if (processed_completion_instructions.includes('#Commit(')) {
110+
const result = await replace_commit_symbol({
109111
instruction: processed_completion_instructions
110112
})
113+
processed_completion_instructions = result.instruction
114+
skill_definitions += result.commit_definitions
111115
}
112116

113-
if (processed_completion_instructions.includes('#ContextAtCommit:')) {
117+
if (processed_completion_instructions.includes('#ContextAtCommit(')) {
114118
processed_completion_instructions =
115119
await replace_context_at_commit_symbol({
116120
instruction: processed_completion_instructions,
117121
workspace_provider: params.panel_provider.workspace_provider
118122
})
119123
}
120124

121-
if (processed_completion_instructions.includes('#SavedContext:')) {
122-
processed_completion_instructions =
123-
await replace_saved_context_placeholder({
124-
instruction: processed_completion_instructions,
125-
context: params.panel_provider.context,
126-
workspace_provider: params.panel_provider.workspace_provider
127-
})
125+
if (processed_completion_instructions.includes('#SavedContext(')) {
126+
const result = await replace_saved_context_symbol({
127+
instruction: processed_completion_instructions,
128+
context: params.panel_provider.context,
129+
workspace_provider: params.panel_provider.workspace_provider
130+
})
131+
processed_completion_instructions = result.instruction
132+
skill_definitions += result.context_definitions
128133
}
129134

130-
if (processed_completion_instructions.includes('#Skill:')) {
135+
if (processed_completion_instructions.includes('#Skill(')) {
131136
const result = await replace_skill_symbol({
132137
instruction: processed_completion_instructions
133138
})
134139
processed_completion_instructions = result.instruction
135-
skill_definitions = result.skill_definitions
140+
skill_definitions += result.skill_definitions
136141
}
137142

138143
const missing_text_tag = processed_completion_instructions
@@ -154,44 +159,50 @@ export const handle_copy_prompt = async (params: {
154159
compact: is_in_prune_context_prompt_type
155160
})
156161

157-
const instructions = replace_selection_placeholder(final_instruction)
162+
const instructions = replace_selection_symbol(final_instruction)
158163

159164
let processed_instructions = instructions
160165
let skill_definitions = ''
161166

162-
if (processed_instructions.includes('#Changes:')) {
163-
processed_instructions = await replace_changes_symbol({
167+
if (processed_instructions.includes('#Changes(')) {
168+
const result = await replace_changes_symbol({
164169
instruction: processed_instructions
165170
})
171+
processed_instructions = result.instruction
172+
skill_definitions += result.changes_definitions
166173
}
167174

168-
if (processed_instructions.includes('#Commit:')) {
169-
processed_instructions = await replace_commit_symbol({
175+
if (processed_instructions.includes('#Commit(')) {
176+
const result = await replace_commit_symbol({
170177
instruction: processed_instructions
171178
})
179+
processed_instructions = result.instruction
180+
skill_definitions += result.commit_definitions
172181
}
173182

174-
if (processed_instructions.includes('#ContextAtCommit:')) {
183+
if (processed_instructions.includes('#ContextAtCommit(')) {
175184
processed_instructions = await replace_context_at_commit_symbol({
176185
instruction: processed_instructions,
177186
workspace_provider: params.panel_provider.workspace_provider
178187
})
179188
}
180189

181-
if (processed_instructions.includes('#SavedContext:')) {
182-
processed_instructions = await replace_saved_context_placeholder({
190+
if (processed_instructions.includes('#SavedContext(')) {
191+
const result = await replace_saved_context_symbol({
183192
instruction: processed_instructions,
184193
context: params.panel_provider.context,
185194
workspace_provider: params.panel_provider.workspace_provider
186195
})
196+
processed_instructions = result.instruction
197+
skill_definitions += result.context_definitions
187198
}
188199

189-
if (processed_instructions.includes('#Skill:')) {
200+
if (processed_instructions.includes('#Skill(')) {
190201
const result = await replace_skill_symbol({
191202
instruction: processed_instructions
192203
})
193204
processed_instructions = result.instruction
194-
skill_definitions = result.skill_definitions
205+
skill_definitions += result.skill_definitions
195206
}
196207

197208
let system_instructions_xml = ''

0 commit comments

Comments
 (0)