File tree Expand file tree Collapse file tree
packages/vscode/src/commands/apply-chat-response-command/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -139,18 +139,6 @@ export const apply_diff = (params: {
139139
140140 if ( line . startsWith ( '@@' ) ) {
141141 if ( search_chunks . length > 0 || replace_chunks . length > 0 ) {
142- // Validate that the hunk has context before adding it
143- if (
144- ! has_context_lines &&
145- search_chunks . length === 0 &&
146- replace_chunks . length > 0
147- ) {
148- throw new Error (
149- 'Zero-context hunk detected: hunks with only additions and no context lines cannot be reliably applied. ' +
150- 'The diff must include surrounding unchanged lines for proper placement.'
151- )
152- }
153-
154142 search_replace_blocks . push (
155143 new SearchBlock ( search_chunks , replace_chunks , - 1 )
156144 )
@@ -220,18 +208,6 @@ export const apply_diff = (params: {
220208 }
221209
222210 if ( search_chunks . length != 0 || replace_chunks . length != 0 ) {
223- // Final validation for zero-context hunks
224- if (
225- ! has_context_lines &&
226- search_chunks . length === 0 &&
227- replace_chunks . length > 0
228- ) {
229- throw new Error (
230- 'Zero-context hunk detected: hunks with only additions and no context lines cannot be reliably applied. ' +
231- 'The diff must include surrounding unchanged lines for proper placement.'
232- )
233- }
234-
235211 // This is crucial for diffs that only have deletions
236212 search_replace_blocks . push (
237213 new SearchBlock ( search_chunks , replace_chunks , - 1 )
You can’t perform that action at this time.
0 commit comments